Editorial: name = TimeZoneBracketedName <= TimeZoneIANAName#1941
Editorial: name = TimeZoneBracketedName <= TimeZoneIANAName#1941FrankYFTang wants to merge 1 commit intotc39:mainfrom
Conversation
Change the definition of name in ParseTemporalTimeZoneString from TimeZoneIANAName to TimeZoneBracketedName
Codecov Report
@@ Coverage Diff @@
## main #1941 +/- ##
=======================================
Coverage 95.01% 95.01%
=======================================
Files 19 19
Lines 10940 10940
Branches 1732 1732
=======================================
Hits 10395 10395
Misses 530 530
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
|
This PR is not good enough. if name is defined as TimeZoneBracketedName step 7a of ParseTemporalTimeZoneString will throw if name is NOT TimeZoneIANAName |
| 1. If _isoString_ does not satisfy the syntax of a |TemporalTimeZoneString| (see <emu-xref href="#sec-temporal-iso8601grammar"></emu-xref>), then | ||
| 1. Throw a *RangeError* exception. | ||
| 1. Let _z_, _sign_, _hours_, _minutes_, _seconds_, _fraction_ and _name_ be the parts of _isoString_ produced respectively by the |UTCDesignator|, |TimeZoneUTCOffsetSign|, |TimeZoneUTCOffsetHour|, |TimeZoneUTCOffsetMinute|, |TimeZoneUTCOffsetSecond|, |TimeZoneUTCOffsetFractionalPart|, and |TimeZoneIANAName| productions, or *undefined* if not present. | ||
| 1. Let _z_, _sign_, _hours_, _minutes_, _seconds_, _fraction_ and _name_ be the parts of _isoString_ produced respectively by the |UTCDesignator|, |TimeZoneUTCOffsetSign|, |TimeZoneUTCOffsetHour|, |TimeZoneUTCOffsetMinute|, |TimeZoneUTCOffsetSecond|, |TimeZoneUTCOffsetFractionalPart|, and |TimeZoneBracketedName| productions, or *undefined* if not present. |
There was a problem hiding this comment.
This change does not look correct to me; I don't think ParseTemporalTimeZoneString input like "2021-12-28T17:42:00Z[-05:00]" (which includes TimeZoneBracketedName but not TimeZoneIANAName) should result in a record with nonempty [[Name]] or input like "2021-12-28T17:42:00+00:00[-05:00]" (likewise) should be rejected when "-05:00" does not pass the IsValidTimeZoneName check.
There was a problem hiding this comment.
@gibson042 could you take a look at tc39/test262#3319 and give your opinion there? I have no strong opinion about this PR . I propose it because @ptomato said it is a spec bug not a bug in the tests. But I am pretty sure this PR in the current shape fix the problem.
There was a problem hiding this comment.
Well, a [[Name]] containing an offset string cannot be passed to IsValidTimeZoneName, so if we make this change, we will have to check for that possibility down below. But I think it is correct that 2021-12-28T17:42:00Z[-05:00] should result in { [[Z]]: true, [[OffsetString]]: undefined, [[Name]]: "-05:00" }. That seems to be what ParseTemporalZonedDateTimeString expects.
Re. the former fix, it may be easier if you implement this on top of #1953.
|
FYI #2050 (currently also a draft) |
|
@FrankYFTang Is this problem still occuring after the fix in #2050? |
It is still occurring, |
Change the definition of name in ParseTemporalTimeZoneString
from TimeZoneIANAName to TimeZoneBracketedName
Without this change, the assertion mententioned in #1924 will fail and therefore is not implementable and the tests mentioned in tc39/test262#3319 will also fail
Fix #1924
@ptomato @pdunkel @ljharb @justingrant @ryzokuken