Skip to content

Editorial: name = TimeZoneBracketedName <= TimeZoneIANAName#1941

Closed
FrankYFTang wants to merge 1 commit intotc39:mainfrom
FrankYFTang:patch-12
Closed

Editorial: name = TimeZoneBracketedName <= TimeZoneIANAName#1941
FrankYFTang wants to merge 1 commit intotc39:mainfrom
FrankYFTang:patch-12

Conversation

@FrankYFTang
Copy link
Contributor

@FrankYFTang FrankYFTang commented Nov 23, 2021

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

Change the definition of name in ParseTemporalTimeZoneString
from TimeZoneIANAName to TimeZoneBracketedName
@codecov
Copy link

codecov bot commented Nov 23, 2021

Codecov Report

Merging #1941 (d3934c8) into main (6224630) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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           
Flag Coverage Δ
test262 81.79% <ø> (ø)
tests 89.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6224630...d3934c8. Read the comment docs.

@FrankYFTang
Copy link
Contributor Author

This PR is not good enough. if name is defined as TimeZoneBracketedName step 7a of ParseTemporalTimeZoneString will throw if name is NOT TimeZoneIANAName

a. If ! IsValidTimeZoneName(name) is false, throw a RangeError exception.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jessealama
Copy link
Collaborator

FYI #2050 (currently also a draft)

@ptomato
Copy link
Collaborator

ptomato commented Apr 12, 2022

@FrankYFTang Is this problem still occuring after the fix in #2050?

@IdanHo
Copy link

IdanHo commented Apr 30, 2022

@FrankYFTang Is this problem still occuring after the fix in #2050?

It is still occurring, TimeZoneBracketedName still has 2 alternatives, TimeZoneIANAName and TimeZoneUTCOffsetName and in the case of the second one the assertion fails. (Example test262 test the fails the assertion: https://github.com/tc39/test262/blob/main/test/built-ins/Temporal/ZonedDateTime/from/zoneddatetime-string.js#L18)

@ptomato
Copy link
Collaborator

ptomato commented May 14, 2022

This part was refactored enough in #2050 that it's probably easier to start over, I've done this in #2200.

@ptomato ptomato closed this May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spec-text Specification text involved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion fail in ToTemporalZonedDateTime

5 participants