Open
Conversation
Collaborator
Author
|
@justingrant Can you think of any more time zone invariants that should be tested here? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3295 +/- ##
=======================================
Coverage 97.83% 97.83%
=======================================
Files 22 22
Lines 10725 10725
Branches 1856 1856
=======================================
Hits 10493 10493
Misses 215 215
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This adds test/thorough/timezones.mjs which tests certain invariants for
time zone transitions in every supported time zone. (It doesn't use
snapshots, because those might have to be updated when the IANA database
updates.)
For every time zone, it takes the first five transitions after 1850
(which was about when time zones started being used) and the last two
transitions before 2000 (which should cover one spring-forward and one
fall-back transition in zones that use DST), and for each of those seven
transitions, tests
- That each `disambiguation` value has the expected effect
- That .with({ offset }) works to switch between the two repeated times
in a fall-back transition
This covers many different sizes of UTC offset shift, from 24 hours down
to 4 seconds, with the most common being -1 hour and +1 hour.
See: #556, tc39/test262#3002
a9b6568 to
5e301d0
Compare
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.
This adds test/thorough/timezones.mjs which tests certain invariants for time zone transitions in every supported time zone. (It doesn't use snapshots, because those might have to be updated when the IANA database updates.)
For every time zone, it takes the first five transitions after 1850 (which was about when time zones started being used) and the last two transitions before 2000 (which should cover one spring-forward and one fall-back transition in zones that use DST), and for each of those seven transitions, tests
disambiguationvalue has the expected effectThis covers many different sizes of UTC offset shift, from 24 hours down to 4 seconds, with the most common being -1 hour and +1 hour.
See: #556, tc39/test262#3002