Repository navigation
Polyfill: Shrink transition search window for Africa/El_Aaiun - #3334
Open
sarankumar1325 wants to merge 1 commit into
Open
sarankumar1325 wants to merge 1 commit into
sarankumar1325 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3332.
searchWindowForTransitionsgives 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,bisectsees three offsets and hits itsassertNotReached. 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:
polyfill/test/ecmascript.mjsforGetNamedTimeZoneNextTransitionandGetNamedTimeZonePreviousTransitionaround the two 1976 transitions. Two of them fail without the change.npm testinpolyfill/: 569 passed. Prettier and ESLint are clean on the changed files.AI disclosure: I wrote this change with help from an AI coding assistant. I reviewed the diff and ran the tests above.