Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 82b8665ef1c3c2c4ec385d1cab7132e3e71056e6
https://github.com/WebKit/WebKit/commit/82b8665ef1c3c2c4ec385d1cab7132e3e71056e6
Author: Yusuke Suzuki <[email protected]>
Date: 2026-06-12 (Fri, 12 Jun 2026)
Changed paths:
A JSTests/stress/temporal-zdt-apia-dateline-gap.js
M Source/JavaScriptCore/runtime/temporal/core/TimeZoneICUBridge.cpp
Log Message:
-----------
[JSC] Use UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE in
getNamedTimeZoneEpochNanoseconds
https://bugs.webkit.org/show_bug.cgi?id=317058
rdar://179540818
Reviewed by Yijia Huang.
When you ask Temporal to resolve a wall-clock datetime in a named time zone,
JSC asks ICU what UTC instant that local time corresponds to. ICU does this
through a calendar object: set the wall fields, read back ucal_getMillis.
Compute the offset at that instant. If icuEpochMs + offset == localMs, the
local time is valid (single candidate, normal case). If they don't match,
the local time does not exist, so it falls in a DST spring-forward gap
(so that time does not exist in the world!!!), and the spec says we need to
record the two bracket offsets (pre-gap beforeNs, post-gap afterNs) so
disambiguation later can pick which side to land on.
To obtain beforeNs, we need the offset of the era immediately before this gap.
The current code's strategy:
1. ucal_setMillis(cal, icuEpochMs) - point the calendar at the gap.
2. ucal_getTimeZoneTransitionDate(cal, UCAL_TZ_TRANSITION_PREVIOUS, ...) - find
the transition that opened this gap.
3. Read the offset 1ms earlier (transitionMs - 1.0) — that's the pre-gap offset.
But UCAL_TZ_TRANSITION_PREVIOUS is strictly less than the calendar's current
millis.
So if the current time is exact point of this boundary, we will not get
that time point.
This patch fixes a bug with UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE.
Test: JSTests/stress/temporal-zdt-apia-dateline-gap.js
* JSTests/stress/temporal-zdt-apia-dateline-gap.js: Added.
(shouldBe):
(shouldThrowRangeError):
* Source/JavaScriptCore/runtime/temporal/core/TimeZoneICUBridge.cpp:
(JSC::TemporalCore::getNamedTimeZoneEpochNanoseconds):
Canonical link: https://commits.webkit.org/315166@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications