question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrate custom date objects and logic to Java 8's Date / Time API

See original GitHub issue

Rather than using the custom-rolled DateTime, Period, Dur, etc. objects, migrate to using Java 8’s Date / Time API (Instant, Period, Duration, etc.).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
benfortunacommented, Feb 25, 2019

Migration to new date/time API will be an extensive project and will likely see a number of alpha releases prior to completion (propose to use 3.1.x release versioning before final release of 4.x).

Points to note as part of migration:

  • Properties that support dates can typically switch between DATE/DATE-TIME values via changing the Value parameter. To support this we require a class to encapsulate a Temporal (date) value and a format flag to indicate the external representation. Propose TemporalAdapter to support parsing/formatting Temporal values
  • Some properties require UTC-based DATE-TIME values. For these we use generics to enforce Instant as the Temporal type such that local/zone-based values aren’t permitted.
  • For classes supporting data types/logic (e.g. Recur) we should use generics where possible to support applicable Temporal types (i.e. Instant = UTC time, OffsetDateTime = zone-based time without DST rules, etc., ZonedDateTime = DST rules, LocalDate = date-only values)
0reactions
benfortunacommented, Aug 22, 2022

v4 now in beta.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating to the New Java 8 Date Time API - Baeldung
In this tutorial you will learn how to refactor your code in order to leverage the new Date Time API introduced in Java...
Read more >
Convert java.util.Date to what “java.time” type? - Stack Overflow
Given that both Instant and java.util.Date are a moment on the timeline in UTC, we can easily move from a java.util.Date to an...
Read more >
New Date-Time API in Java 8 - GeeksforGeeks
Local : Simplified date-time API with no complexity of timezone handling. Zoned : Specialized date-time API to deal with various timezones.
Read more >
Java SE 8 Date and Time - Oracle
The first classes you will probably encounter when using the new API are LocalDate and LocalTime . They are local in the sense...
Read more >
Java 8 Date Time - 20 Examples of LocalDate, LocalTime ...
One of the many good things about new Date and Time API is that now it defines principle date-time concepts e.g. instants, duration,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found