-
Notifications
You must be signed in to change notification settings - Fork 153
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: Support 'T' prefix in time-only strings and require it in cases of ambiguity #1952
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1952 +/- ##
==========================================
+ Coverage 94.96% 94.97% +0.01%
==========================================
Files 19 19
Lines 10967 10989 +22
Branches 1743 1751 +8
==========================================
+ Hits 10415 10437 +22
Misses 535 535
Partials 17 17
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Draft until presented at TC39 |
This achieved consensus at the December 2021 TC39 meeting. |
04a13c5
to
c380e4f
Compare
ISO 8601 requires the 'T' prefix in cases where the time-only representation is ambiguous. Closes: #1765
c380e4f
to
bc4b64c
Compare
Slightly refector the implementation of tc39#1952 to enable a clearer error message when the user tries to parse a date-only string with `PlainTime.from`. This is the same pattern that's used for other polyfill parsing: `ParseISODateTime` is used for generic, regex-only parsing while type-specific validation happens in the calling method, e.g. `ParseTemporalTimeString` or `ParseTemporalZonedDateTimeString`. Also add tests to verify that date strings are not allowed, and that space is not accepted as a time designator prefix even though space is accepted as a date/time separator.
Slightly refector the implementation of #1952 to enable a clearer error message when the user tries to parse a date-only string with `PlainTime.from`. This is the same pattern that's used for other polyfill parsing: `ParseISODateTime` is used for generic, regex-only parsing while type-specific validation happens in the calling method, e.g. `ParseTemporalTimeString` or `ParseTemporalZonedDateTimeString`. Also add tests to verify that date strings are not allowed, and that space is not accepted as a time designator prefix even though space is accepted as a date/time separator.
Port of two overlapping PRs (the latter is a revision of the former): * tc39/proposal-temporal#1952 * tc39/proposal-temporal#1986
Port of two overlapping PRs (the latter is a revision of the former): * tc39/proposal-temporal#1952 * tc39/proposal-temporal#1986
tc39/proposal-temporal#1952 added support for time designator prefixes in PlainTime strings. This adds three tests to all entry points that convert an ISO string to a PlainTime: - no-implicit-midnight: ISO strings with only a date and no time are no longer accepted. Previously they were implicitly interpreted as 00:00. - with-time-designator: Tests that various forms of string with time designator are correctly parsed. - time-designator-required-for-disambiguation: Tests various cases where a string without a time designator is ambiguous and therefore the time designator is required, as well as various cases that implementations might assume are ambiguous but in fact are not. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
tc39/proposal-temporal#1952 added support for time designator prefixes in PlainTime strings. This adds three tests to all entry points that convert an ISO string to a PlainTime: - no-implicit-midnight: ISO strings with only a date and no time are no longer accepted. Previously they were implicitly interpreted as 00:00. - with-time-designator: Tests that various forms of string with time designator are correctly parsed. - time-designator-required-for-disambiguation: Tests various cases where a string without a time designator is ambiguous and therefore the time designator is required, as well as various cases that implementations might assume are ambiguous but in fact are not. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
tc39/proposal-temporal#1952 added support for time designator prefixes in PlainTime strings. This adds three tests to all entry points that convert an ISO string to a PlainTime: - no-implicit-midnight: ISO strings with only a date and no time are no longer accepted. Previously they were implicitly interpreted as 00:00. - with-time-designator: Tests that various forms of string with time designator are correctly parsed. - time-designator-required-for-disambiguation: Tests various cases where a string without a time designator is ambiguous and therefore the time designator is required, as well as various cases that implementations might assume are ambiguous but in fact are not. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
tc39/proposal-temporal#1952 added support for time designator prefixes in PlainTime strings. This adds three tests to all entry points that convert an ISO string to a PlainTime: - no-implicit-midnight: ISO strings with only a date and no time are no longer accepted. Previously they were implicitly interpreted as 00:00. - with-time-designator: Tests that various forms of string with time designator are correctly parsed. - time-designator-required-for-disambiguation: Tests various cases where a string without a time designator is ambiguous and therefore the time designator is required, as well as various cases that implementations might assume are ambiguous but in fact are not. This was a normative change that achieved consensus at the December 2021 TC39 meeting.
Why do we need to introduce "CalendarDate" which is only used in an Assert? $ egrep "CalendarDate[^a-zA-Z]" * Could we remove that from that spec? |
This is done in #2187. |
Spec text: https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar Support 'T' prefix in time-only strings and require it in cases of ambiguity Remove TemporalDateString and TemporalRelativeToString from parser Change algorithm of ParseTemporalDateString Related spec changes: tc39/proposal-temporal#1952 tc39/proposal-temporal#2187 Bug: v8:11544 Change-Id: I7430afabb7dd78930b339b818bad7c7721decb99 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3636361 Reviewed-by: Shu-yu Guo <[email protected]> Commit-Queue: Frank Tang <[email protected]> Cr-Commit-Position: refs/heads/main@{#81792}
Includes #1950 to avoid rebase conflicts. I'll make sure that one is merged before this one.
Closes: #1765