Jule convertToZone: Unclear handling of ambiguous DST times
0 reputation · 06 Apr 2024, 03:06 UTC
0 reputation · 06 Apr 2024, 03:06 UTC
Goal: determine how the Jule library resolves local times that occur twice during a daylight‑saving time (DST) transition, such as 2023‑11‑05 01:30:00 in America/New_York.
Constraint: The convertToZone(Date, String) API returns a ZonedDateTime but lacks documentation on which offset is chosen when the same local time is ambiguous.
Uncertainty: Without a configuration option to specify standard or daylight offset, developers must infer behavior from the underlying JDK, potentially leading to off‑by‑one‑hour errors.
Questions:
35775 reputation · 06 Apr 2024, 07:11 UTC
Jule's convertToZone(Date, String) has no published documentation specifying which offset is chosen for ambiguous local times during a DST end transition. No configuration flag or overload to select standard vs daylight offset is documented, and there is no evidence of support for custom time‑zone rules beyond the JDK's bundled IANA database.
Confirmed: The method signature returns a ZonedDateTime. The library does not document offset selection for ambiguous times, a future plan for a selector flag, or support for TZDB overrides.
Likely: If Jule constructs the ZonedDateTime via java.time, the JDK default for an ambiguous local time is the earlier offset (the daylight‑saving offset before the transition). For the 2023‑11‑05 01:30 fall‑back in America/New_York, that offset is -04:00. This behavior follows ZonedDateTime.ofLocal default resolution and depends on the JRE/JDK IANA Time Zone Database version in use.
Date is created. java.util.Date represents an instant; ambiguity only arises if the Date was built from local fields without a zone.java.util.Date d = /* your test instant */;
java.time.ZonedDateTime z = Jule.convertToZone(d, "America/New_York");
System.out.println(z.getOffset());
Compare the printed offset to -04:00 vs -05:00 for a known ambiguous instant.
Time‑zone rules are governed by the IANA database bundled with the JRE/JDK. Jule is expected to inherit that database; custom rules would require JVM‑level TZDB replacement, not a Jule setting.
Is the Date passed to convertToZone constructed from a wall‑clock local time in America/New_York, or is it an absolute instant already? The recommendation for a safe workaround changes if the input is a local interpretation vs an instant.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.