Skip to content
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: Accept and ignore calendar annotation in Instant string #2345

Merged
merged 2 commits into from
Aug 25, 2022

Conversation

ptomato
Copy link
Collaborator

@ptomato ptomato commented Jul 5, 2022

Parsing an Instant string already ignores the time zone name annotation if
one is present, and only takes the offset into account. It's inconsistent
to throw if a calendar annotation is present but not if a time zone name
annotation is present.

Closes: #2143

@ptomato ptomato added spec-text Specification text involved normative Would be a normative change to the proposal labels Jul 5, 2022
@codecov
Copy link

codecov bot commented Jul 5, 2022

Codecov Report

Merging #2345 (b7cb9f4) into main (e938a3e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2345   +/-   ##
=======================================
  Coverage   95.02%   95.02%           
=======================================
  Files          20       20           
  Lines       10820    10820           
  Branches     1929     1929           
=======================================
  Hits        10282    10282           
  Misses        504      504           
  Partials       34       34           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ptomato ptomato marked this pull request as draft July 12, 2022 00:31
@FrankYFTang
Copy link
Contributor

This PR is already tested in https://github.com/tc39/test262/blob/main/test/built-ins/Temporal/Instant/from/argument-string.js are we waiting for additional test cases or something else to merge?

@ptomato
Copy link
Collaborator Author

ptomato commented Aug 24, 2022

We need to adapt that test to cover other API entry points that take a string and call ToTemporalInstant on it, such as Temporal.Instant.prototype.since() and Temporal.TimeZone.prototype.getOffsetNanosecondsFor().

@ptomato
Copy link
Collaborator Author

ptomato commented Aug 25, 2022

This achieved consensus at the July 2022 meeting of TC39, tests are in tc39/test262#3645

Parsing an Instant string already ignores the time zone name annotation if
one is present, and only takes the offset into account. It's inconsistent
to throw if a calendar annotation is present but not if a time zone name
annotation is present.

Closes: #2143
@ptomato ptomato force-pushed the 2143-instant-ignore-calendar branch from 6d1f153 to b7cb9f4 Compare August 25, 2022 17:17
@ptomato ptomato merged commit e1862aa into main Aug 25, 2022
@ptomato ptomato deleted the 2143-instant-ignore-calendar branch August 25, 2022 17:22
pull bot pushed a commit to jamlee-t/v8 that referenced this pull request Sep 10, 2022
Add TimeHourMinuteBasicFormatNotAmbiguousWithMonthDay
TimeZoneNumericUTCOffsetNotAmbiguousWithDayOfMonth
TimeZoneNumericUTCOffsetNotAmbiguousWithMonth
TimeZoneIdentifier, UnpaddedHour, TimeZoneIANALegacyName productions.

Sync the spec of TemporalInstantString, TemporalTimeString
TimeZone, TimeZoneBracketedAnnotation, TemporalTimeZoneString,
ToTemporalTimeZone, TimeZoneIANAName productions.

Fix bug in ScanCalendarDateTimeTimeRequired, ToTemporalTimeZone

Change name from Handle<String> to Handle<Object> to hold undefined

Update parser tests accordingly.

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar
https://tc39.es/proposal-temporal/#sec-temporal-totemporaltimezone


Related PR changes:
tc39/proposal-temporal#2284
tc39/proposal-temporal#2287
tc39/proposal-temporal#2345


Bug: v8:11544
Change-Id: I6f1a5e5dedba461db9f36abe76fa97119c1f8c2c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3822342
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83123}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
normative Would be a normative change to the proposal spec-text Specification text involved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grammar should accept calendar in Instant strings
5 participants