Normative: Allow ISO strings with "Z" + a bracketed IANA name#1749
Merged
Normative: Allow ISO strings with "Z" + a bracketed IANA name#1749
Conversation
Collaborator
Author
|
Tests to follow. |
Collaborator
Author
|
(Also, marking as draft because normative) |
Codecov Report
@@ Coverage Diff @@
## main #1749 +/- ##
==========================================
+ Coverage 94.85% 94.91% +0.06%
==========================================
Files 19 19
Lines 10882 10807 -75
Branches 1729 1736 +7
==========================================
- Hits 10322 10258 -64
+ Misses 547 536 -11
Partials 13 13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
0e88e8e to
71eff06
Compare
Collaborator
Author
|
This change achieved consensus in TC39. @Ms2ger Do you want to take a final look at the tests I added recently? |
Previously we had decided to always throw on these strings. Based on feedback from the IETF SEDATE working group, we are going to allow them. This means changes to what kinds of strings are allowed in several contexts. See #1695 for more information. The following diagram may be helpful when reading this commit. "datetime" = e.g. "2021-08-19T17:30" "offset" = e.g. "-07:00" "bracket" = e.g. "[America/Vancouver]", "[-07:00]" or "[UTC]" TimeZone.from: - datetime + Z -> UTC - datetime + offset -> offset time zone - datetime + bracket -> IANA time zone - datetime + Z + bracket -> " - datetime + offset + bracket -> " - throws on a bare datetime string ZonedDateTime.from: - datetime + bracket -> preserve wall time in the IANA time zone - datetime + Z + bracket -> preserve exact time in the IANA time zone - datetime + offset + bracket -> consult offset option if ambiguous - throws on a string with no bracket Instant.from: - datetime + Z -> preserve exact time - datetime + offset -> " - datetime + Z + bracket -> preserve exact time, ignore bracket - datetime + offset + bracket -> " - throws on a bare datetime string, or datetime + bracket relativeTo: - datetime + bracket -> do what ZonedDateTime.from does - datetime + Z + bracket -> " - datetime + offset + bracket -> " - anything else -> do what PlainDateTime.from does Closes: #1695 Closes: #1696
71eff06 to
9a2bf1d
Compare
Ms2ger
approved these changes
Sep 2, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously we had decided to always throw on these strings. Based on
feedback from the IETF SEDATE working group, we are going to allow them.
This means changes to what kinds of strings are allowed in several
contexts. See #1695 for more information.
The following diagram may be helpful when reading this commit.
"datetime" = e.g. "2021-08-19T17:30"
"offset" = e.g. "-07:00"
"bracket" = e.g. "[America/Vancouver]", "[-07:00]" or "[UTC]"
TimeZone.from:
ZonedDateTime.from:
Instant.from:
relativeTo:
Closes: #1695
Closes: #1696