Skip to content

Polyfill: Shrink transition search window for Africa/El_Aaiun - #3334

Open
sarankumar1325 wants to merge 1 commit into
tc39:mainfrom
sarankumar1325:polyfill-el-aaiun-transition-window
Open

sarankumar1325 wants to merge 1 commit into
tc39:mainfrom
sarankumar1325:polyfill-el-aaiun-transition-window

Conversation

@sarankumar1325

Copy link
Copy Markdown

Fixes #3332.

searchWindowForTransitions gives Africa/El_Aaiun a 17-day window, but two of its transitions are 16 days 23 hours apart (1976-04-14T01:00Z, -01:00 → +00:00, and 1976-05-01T00:00Z, +00:00 → +01:00). When a window holds both, bisect sees three offsets and hits its assertNotReached. For example, getTimeZoneTransition('next') from 1976-04-14T00:30Z throws instead of returning the 04-14 transition.

This changes the window to 16 days. A smaller window only means more steps before bisecting, so other lookups in this zone still give the same results.

I scanned Africa/El_Aaiun in 30-minute steps from 1900 to 2045 with the box's Node 24 ICU data (tz 2026e). The smallest gap between transitions is that 16.958-day one, so 16 days is enough.

Tests:

  • Added cases to polyfill/test/ecmascript.mjs for GetNamedTimeZoneNextTransition and GetNamedTimeZonePreviousTransition around the two 1976 transitions. Two of them fail without the change.
  • npm test in polyfill/: 569 passed. Prettier and ESLint are clean on the changed files.
  • The repro calls in Polyfill: getTimeZoneTransition throws a bisection assertion for Africa/El_Aaiun in 1976 #3332 now return the expected transitions, and the control cases are unchanged. I didn't run test262 or the thorough suite locally.

AI disclosure: I wrote this change with help from an AI coding assistant. I reviewed the diff and ran the tests above.

Africa/El_Aaiun has two transitions 16 days 23 hours apart, on
1976-04-14 and 1976-05-01. With a 17-day search window both can fall
into the same window, so bisect sees three offsets and hits its
assertion. A 16-day window holds at most one of them.

Closes: tc39#3332

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Polyfill: getTimeZoneTransition throws a bisection assertion for Africa/El_Aaiun in 1976

1 participant