-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Limit offset time zones to minutes precision #2607
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a little in, but honestly am feeling overwhelmed by the plethora of abstract operations. For me at least, I think the splits hinder comprehension.
ae020e9
to
1dd7030
Compare
Codecov Report
@@ Coverage Diff @@
## main #2607 +/- ##
==========================================
- Coverage 95.96% 95.94% -0.03%
==========================================
Files 20 20
Lines 11536 11550 +14
Branches 2191 2197 +6
==========================================
+ Hits 11071 11082 +11
- Misses 401 404 +3
Partials 64 64
|
9f1fc24
to
53f8027
Compare
V2 is available. It's a refactor based on @gibson042's advice around parsing and grammar. Let me know if you see problems with this version. If not then I'll move onto Test262. |
Also, I updated the OP so you can see a summary of the latest design. |
09cec14
to
f6818ce
Compare
@gibson042 @ptomato PR is now ready for review. I split it up into one editorial commit that refactors offset handling, and two normative commits:
I'll work on Test262 next. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of good work here, but I think a little more is still warranted.
f6818ce
to
123cb3e
Compare
2c3a752
to
36487a6
Compare
@ptomato I think this one is ready to merge. After it's merged I can rebase #2574 on the updated main, and then that PR should be ready to go as well after tests are reviewed and merged. |
At implementers' request to reduce the storage requirements of Temporal.TimeZone from 49+ bits to 12-13 bits, this commit requires that the [[OffsetNanoseconds]] internal slot of Temporal.TimeZone is limited to minute precision. Sub-minute precision is still allowed for custom time zone objects and built-in named time zones. In other words, this commit changes storage requirements but not internal calculation requirements. This commit is fairly narrow: * Changes |TimeZoneUTCOffsetName| production to restrict allowed offset syntax for parsing. * Changes FormatOffsetTimeZoneIdentifier AO to format minute strings only. * Moves sub-minute offset formatting from FormatOffsetTimeZoneIdentifier to instead be inlined in GetOffsetStringFor, which is now the only place where sub-minute offsets are formatted. Fixes tc39#2593.
This commit adds a "normalized format of a time zone identifier" definition, and uses it to ensure that SystemTimeZoneIdentifier only returns normalized identifiers like "-05:00" (not "-0500" nor "-05") or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor "AmErIcA/lOs_AnGeLeS"). No current implementations return offset strings in non-normalized format, so although this is a normative change, it won't break existing ECMAScript code nor will it require changes to current implementations. Fixes tc39#2584.
Modify/add tests for tc39/proposal-temporal#2607
36487a6
to
9a90070
Compare
Modify/add tests for tc39/proposal-temporal#2607
9a90070
to
fd7fccd
Compare
This commit verifies that ISO strings with sub-minute offsets cannot be parsed into time zone identifiers. This was a change introduced in the recently-merged tc39/proposal-temporal#2607, but tests for this case were missing from tc39#3862 (the tests for that PR). I noticed in codecov results on an unrelated PR that this case wasn't being tested, so fixing that mistake now.
This commit verifies that ISO strings with sub-minute offsets cannot be parsed into time zone identifiers. This was a change introduced in the recently-merged tc39/proposal-temporal#2607, but tests for this case were missing from tc39#3862 (the tests for that PR). I noticed in codecov results on an unrelated PR that this case wasn't being tested, so fixing that mistake now.
This commit verifies that ISO strings with sub-minute offsets cannot be parsed into time zone identifiers. This was a change introduced in the recently-merged tc39/proposal-temporal#2607, but tests for this case were missing from tc39#3862 (the tests for that PR). I noticed in codecov results on an unrelated PR that this case wasn't being tested, so fixing that mistake now.
This commit verifies that ISO strings with sub-minute offsets cannot be parsed into time zone identifiers. This was a change introduced in the recently-merged tc39/proposal-temporal#2607, but tests for this case were missing from tc39#3862 (the tests for that PR). I noticed in codecov results on an unrelated PR that this case wasn't being tested, so fixing that mistake now.
There was one remaining Temporal test that was parsing an ISO string with a sub-minute offset into a Temporal.TimeZone. A polyfill bug was allowing this test case to pass, even though after tc39/proposal-temporal#2607 it should have failed. This commit removes the bad test case.
Modify/add tests for tc39/proposal-temporal#2607 added tests for valid language tags removed unnecessary requirement for DisplayNames-v2
This commit verifies that ISO strings with sub-minute offsets cannot be parsed into time zone identifiers. This was a change introduced in the recently-merged tc39/proposal-temporal#2607, but tests for this case were missing from tc39#3862 (the tests for that PR). I noticed in codecov results on an unrelated PR that this case wasn't being tested, so fixing that mistake now.
There was one remaining Temporal test that was parsing an ISO string with a sub-minute offset into a Temporal.TimeZone. A polyfill bug was allowing this test case to pass, even though after tc39/proposal-temporal#2607 it should have failed. This commit removes the bad test case.
This commit verifies that ISO strings with sub-minute offsets cannot be parsed into time zone identifiers. This was a change introduced in the recently-merged tc39/proposal-temporal#2607, but tests for this case were missing from tc39#3862 (the tests for that PR). I noticed in codecov results on an unrelated PR that this case wasn't being tested, so fixing that mistake now.
There was one remaining Temporal test that was parsing an ISO string with a sub-minute offset into a Temporal.TimeZone. A polyfill bug was allowing this test case to pass, even though after tc39/proposal-temporal#2607 it should have failed. This commit removes the bad test case.
This commit verifies that ISO strings with sub-minute offsets cannot be parsed into time zone identifiers. This was a change introduced in the recently-merged tc39/proposal-temporal#2607, but tests for this case were missing from #3862 (the tests for that PR). I noticed in codecov results on an unrelated PR that this case wasn't being tested, so fixing that mistake now.
There was one remaining Temporal test that was parsing an ISO string with a sub-minute offset into a Temporal.TimeZone. A polyfill bug was allowing this test case to pass, even though after tc39/proposal-temporal#2607 it should have failed. This commit removes the bad test case.
Implements the changes from: - tc39/proposal-temporal#2621 - tc39/proposal-temporal#2622 - tc39/proposal-temporal#2632 - tc39/proposal-temporal#2607 Differential Revision: https://phabricator.services.mozilla.com/D185412
Implements the changes from: - tc39/proposal-temporal#2621 - tc39/proposal-temporal#2622 - tc39/proposal-temporal#2632 - tc39/proposal-temporal#2607 Differential Revision: https://phabricator.services.mozilla.com/D185412
This PR limits offset time zones to minutes precision to address implementer feedback that the storage requirements of Temporal.TimeZone are too large. This PR reduces Temporal.TimeZone storage requirements from 49 bits to 12-13 bits.
The first normative commit changes
|TimeZoneUTCOffsetName|
to minutes precision and moves sub-minute offset formatting from FormatOffsetTimeZoneIdentifier to GetOffsetStringFor.The second normative commit ensures that SystemTimeZoneIdentifier cannot return offsets greater than minute precision, and ensures that any offsets are returned in normalized form (e.g.
-05:00
not-05
nor-0500
). Note that no current implementation returns offsets from SystemTimeZoneIdentifier, so although this commit is a normative change to an existing ECMA-262 abstract operation, it won't require changes to existing implementation nor will it break existing ECMAScript programs.This PR fixes #2593 and fixes #2584, and is marked as a draft until it can be presented at the July 2023 TC39 plenary meeting.
Tests are at tc39/test262#3862.