Normative: Fix production for time zone name in time zone strings#2200
Normative: Fix production for time zone name in time zone strings#2200
Conversation
|
Draft until presented to TC39. |
Codecov Report
@@ Coverage Diff @@
## main #2200 +/- ##
==========================================
+ Coverage 84.01% 91.09% +7.08%
==========================================
Files 18 19 +1
Lines 4766 10577 +5811
Branches 1088 1696 +608
==========================================
+ Hits 4004 9635 +5631
- Misses 594 932 +338
+ Partials 168 10 -158
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
So... TimeZoneNumericUTCOffset will be the value for both offsetString and name if it present in the string? [from what I can read from your PR) Could ou list some example to illustrate the problem and expectation. Thanks |
|
@FrankYFTang Here are the cases I'm thinking of:
I do see one oddity in this list, that's parsing Just for avoidance of any doubt, I think it's enough to have TemporalTimeZoneIdentifier enclose TimeZoneUTCOffsetName instead of TimeZoneNumericUTCOffset. This would be an editorial change because I don't think it's possible to see any observable semantics from changing it. |
0e7bb9a to
2900ad7
Compare
|
I rebased this on the editorial change that I mentioned. Now it is a simpler change, and the oddity with |
|
The following tests will no longer be valid with this change:
The tests use time zone strings like |
Hmm, I'm not sure that's intentional. We'll take another look. |
ParseTemporalTimeZoneString erroneously assumed that any bare time zone identifier or bracketed name would be an IANA name. That is not the case, it can be a UTC offset name as well. Closes: #1805
|
If I understand the situation correctly it's because I believe the solution is to add the "match minutes" behaviour to ToTemporalTimeZone, just like it is in ToTemporalZonedDateTime and ToRelativeTemporalObject. I think it should be OK to tack another commit on to this PR to restore the original situation we had. I'll do this today. |
|
...or maybe we were originally intending to discard the offset string if a bracketed name was present, when parsing a time zone string? I'll dig into the discussion archives. |
In [2a81fbc] I inadvertently added this validation that the offset string is equal to a bracketed offset string in TimeZone.from(). Instead, the offset string should be ignored when there is a bracketed name. The accidental change invalidated several test262 tests, which should now be valid once more.
2900ad7 to
0c657e5
Compare
|
@anba How does this look to you? |
I think that should work. Just to double check, we'll end up with the following behaviour:
|
|
That is correct, I believe. The principle is that each from() method only pays attention to the relevant parts of the string, as long as it is syntactically correct. (ZonedDateTime.from() can also accept mismatched time zone information if you give it the |
|
This change achieved consensus in the June 2022 TC39 plenary meeting, and the fix for anba's issue does not change the intention of the normative change. I'll go ahead and merge this. It is already covered by test262 tests. |
ParseTemporalTimeZoneString erroneously assumed that any bare time zone
identifier or bracketed name would be an IANA name. That is not the case,
it can be a UTC offset name as well.
Closes: #1805