DST makes local times ambiguous
A local time during a daylight-saving transition may occur twice or not at all. Resolve it with an explicit zone and documented overlap or gap policy.
Clear note on java / time. "DST makes local times ambiguous" is the kind of detail that is easy to overlook.
Crucial
Elegant
- @sohmeh▲ 1
"DST makes local times ambiguous" is a useful thing to know about with java / time. Thanks for sharing it.
Clever
Local date-times fall into an overlap or a gap when clocks change, so a single conversion can be ambiguous. Use a zone-aware type and document which offset the code picks for each case.
During a DST transition a local time can map to two instants or to none. Pass an explicit ZoneId and define the rule for overlaps and gaps before converting.
ZonedDateTime.ofpicks the earlier offset in an overlap and shifts forward across a gap. Seen another edge case with this? Add it below.Appreciate the write-up on "DST makes local times ambiguous". Useful for anyone using java / time.
Specific and to the point: "DST makes local times ambiguous". Worth a look if you touch java / time.
Clear note on java / time. "DST makes local times ambiguous" is the kind of detail that is easy to overlook.
Appreciate the write-up on "DST makes local times ambiguous". Useful for anyone using java / time.