Skip to content

Commit 2bd63a6

Browse files
committed
Add a link to blog post explaining usage differences between Instant and LocalDateTime
1 parent 64a3c14 commit 2bd63a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ Here is some basic advice on how to choose which of the date-carrying types to u
4848
- Use `Instant` to represent a timestamp of the event that had already happened in the past (like a timestamp of
4949
a log entry) or will definitely happen in a well-defined instant of time in the future not far away from now
5050
(like an order confirmation deadline in 1 hour from now).
51+
5152
- Use `LocalDateTime` to represent a time of the event that is scheduled to happen in the far future at a certain
5253
local time (like a scheduled meeting in a few months from now). You'll have to keep track of the `TimeZone` of
5354
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+
5558
Also, use `LocalDateTime` to decode an `Instant` to its local date-time components for display and UIs.
59+
5660
- Use `LocalDate` to represent a date of the event that does not have a specific time associated with it (like a birth date).
5761

5862
## Operations

0 commit comments

Comments
 (0)