You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,11 +48,15 @@ Here is some basic advice on how to choose which of the date-carrying types to u
48
48
- Use `Instant` to represent a timestamp of the event that had already happened in the past (like a timestamp of
49
49
a log entry) or will definitely happen in a well-defined instant of time in the future not far away from now
50
50
(like an order confirmation deadline in 1 hour from now).
51
+
51
52
- Use `LocalDateTime` to represent a time of the event that is scheduled to happen in the far future at a certain
52
53
local time (like a scheduled meeting in a few months from now). You'll have to keep track of the `TimeZone` of
53
54
the scheduled event separately. Try to avoid converting future events to `Instant` in advance, because time-zone
54
-
rules might change unexpectedly in the future.
55
+
rules might change unexpectedly in the future. In this [blog post](https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/), you can read more about why it's not always
56
+
a good idea to use `Instant` everywhere.
57
+
55
58
Also, use `LocalDateTime` to decode an `Instant` to its local date-time components for display and UIs.
59
+
56
60
- Use `LocalDate` to represent a date of the event that does not have a specific time associated with it (like a birth date).
0 commit comments