Because translation is not injective. Take Sunday, October 30, 2016, 2:15 in Germany / Munich, for example: Which Instant
does this date / time match? It does not depend on any assumptions, because you do not know whether this time should be converted to Instant
before or after the shift for daylight saving time (DST). Or Sunday, March 27, 2016 2:15 AM in Germany / Munich: This combination of date and time should not exist, since the clock must be set to 3 hours when it reaches 2 hours.
Without DST, the three possible cases for converting a LocalDateTime
to Instant
(exact match, summer time overlap, winter overlap) will be reduced to one, and the conversion will be injective, AFAIK.
Edit: Hands, this problem, when you display the date / time in our JSF-based application, we always transfer the offset calculated according to the current state of the DST to the formatter.
source share