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

Editorial changes in preparation for incorporating IETF draft #2385

Merged
merged 6 commits into from
Aug 31, 2022

Conversation

ptomato
Copy link
Collaborator

@ptomato ptomato commented Aug 25, 2022

Now that the IETF draft for the date-time format with annotations (codenamed "IXDTF") is ready, I'm preparing a normative PR to incorporate its conclusions into the proposal (#1450). I'm still chasing down a few loose ends on that, but here is a PR with editorial changes that prepare the way for it.

Best reviewed commit by commit.

@codecov
Copy link

codecov bot commented Aug 25, 2022

Codecov Report

Merging #2385 (a0e50d7) into main (d5a7703) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head a0e50d7 differs from pull request most recent head 45975fd. Consider uploading reports for the commit 45975fd to get more accurate results

@@           Coverage Diff           @@
##             main    #2385   +/-   ##
=======================================
  Coverage   95.02%   95.02%           
=======================================
  Files          20       20           
  Lines       10820    10822    +2     
  Branches     1929     1926    -3     
=======================================
+ Hits        10282    10284    +2     
  Misses        504      504           
  Partials       34       34           
Impacted Files Coverage Δ
polyfill/lib/ecmascript.mjs 98.30% <100.00%> (-0.01%) ⬇️
polyfill/lib/regex.mjs 100.00% <100.00%> (ø)

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

@ptomato ptomato requested a review from Ms2ger August 30, 2022 20:46
Now that annotations are an integral part of IXDTF strings, it's better to
handle them at the same time inside of ParseISODateTime. This work is
preparatory to the normative change that we will have to do to accept the
annotation format defined in IXDTF.

(IXDTF is the working abbreviation of the IETF draft; it stands for
Internet Extended Date-Time Format)

Previously we would call ParseISODateTime on a string and subsequently
ParseTemporalTimeZoneString on the same string. In addition to the benefit
mentioned above, the previous situation could also lead to confusion since
it parsed the string twice, and ParseTemporalTimeZoneString also accepts
a bare time zone identifier (even though that branch of the grammar is
not used in this case, because a bare time zone identifier can never be a
valid ISO string.)

Now, the Record returned by ParseISODateTime gains a [[TimeZone]] field
which contains another Record of the same type that is returned by
ParseTemporalTimeZoneString.
@ptomato ptomato force-pushed the editorial-ietf-draft branch from 04022a3 to a0e50d7 Compare August 30, 2022 21:23
polyfill/lib/ecmascript.mjs Outdated Show resolved Hide resolved
polyfill/lib/ecmascript.mjs Outdated Show resolved Hide resolved
Use early returns and combine similar conditions to make the control flow
through this operation slightly easier to follow.
This was a bit of a mess. Rewrite the operation so that it tries to parse
the string as a bare time zone identifier _first_, and if that fails,
as an ISO string, throwing if the ISO string doesn't contain any time zone
(whether Z designator, UTC offset, or IANA name).

This was what the operation previously did, just much more difficult to
follow.

The reference polyfill mostly already worked like this, but move the
IANA name canonicalization step out of ParseTemporalTimeZoneString and
into its only caller, to correspond better with the spec text. This also
requires bringing the time zone ID regex better in line with the grammar's
|TimeZoneIdentifier| production by adding the IANA legacy names.
This helps when debugging which property is not being parsed correctly.
@ptomato ptomato force-pushed the editorial-ietf-draft branch from a0e50d7 to 45975fd Compare August 31, 2022 17:46
@ptomato ptomato merged commit b4d9abc into main Aug 31, 2022
@ptomato ptomato deleted the editorial-ietf-draft branch August 31, 2022 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants