Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ZoneId rather than ZoneOffset for conversion (#9620)
Use ZoneId rather than ZoneOffset for conversion between model (Date) and presentation of LocalDateTime. LocalDateToDateConverter (correctly) uses ZoneId, whereas LocalDateTimeToDateConverter (incorrectly) used a ZoneOffset. This fix aligns the two Converter implementations and makes the latter one more robust. A ZoneOffset is a fixed time difference, e.g., +07:00, whereas a time zone - represented by a ZoneId - is more dynamic, including features like Daylight-Savings Time. A ZoneId returns one or more ZoneOffsets via its ZoneRules method. (ZoneOffsets have trivial ZoneRules that simply return the ZoneOffset.) Since the date/time being displayed may be from any date on the calendar, the ZoneOffset imposes a negative limitation. Using ZoneId instead gets us past that limitation and allows a more robust set of conversion rules. Fixes #9594
- Loading branch information