You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Editorial: Introduce Time Zone Identifier Parse Record
This Record was previously anonymous. Introduce it as a specific Record
type in order to clarify the limits of the [[OffsetMinutes]] field and
that the two fields are mutually exclusive.
Since this type information is considered to be equivalent to
assertions, this allows removing some assertions and some descriptive
text from elsewhere.
Credit to Vebjørn Øiestad for discovering this.
Co-Authored-By: Vebjørn Øiestad <102312685+voiestad@users.noreply.github.com>
<p>A <dfnvariants="Time Zone Identifier Parse Records">Time Zone Identifier Parse Record</dfn> is a Record value used to represent the result of parsing a time zone identifier either as an offset time zone or named time zone.</p>
1417
+
<p>Time Zone Identifier Parse Records have the fields listed in <emu-xrefhref="#table-temporal-time-zone-identifier-parse-record-fields"></emu-xref>.</p>
1418
+
<p>The two fields are mutually exclusive. One of them always has the value ~empty~.</p>
1419
+
<emu-tableid="table-temporal-time-zone-identifier-parse-record-fields"caption="Time Zone Identifier Parse Record Fields">
1420
+
<tableclass="real-table">
1421
+
<tr>
1422
+
<th>Field Name</th>
1423
+
<th>Value</th>
1424
+
<th>Meaning</th>
1425
+
</tr>
1426
+
<tr>
1427
+
<td>[[Name]]</td>
1428
+
<td>a String or ~empty~</td>
1429
+
<td>
1430
+
The time zone's name (not necessarily an available named time zone identifier), or ~empty~ if the time zone is an offset time zone.
1431
+
</td>
1432
+
</tr>
1433
+
<tr>
1434
+
<td>[[OffsetMinutes]]</td>
1435
+
<td>an integer in the inclusive interval from -1439 to 1439, or ~empty~</td>
1436
+
<td>
1437
+
The time zone's UTC offset expressed as a number of minutes, or ~empty~ if the time zone is a named time zone.
<p>An <dfnvariants="ISO Date-Time Parse Records">ISO Date-Time Parse Record</dfn> is a Record value used to represent the result of parsing an ISO 8601 / RFC 9557 string.</p>
@@ -1706,20 +1736,20 @@ <h1>
1706
1736
<h1>
1707
1737
ParseTemporalTimeZoneString (
1708
1738
_timeZoneString_: a String,
1709
-
): either a normal completion containing a Record containing information about the time zone, or a throw completion
1739
+
): either a normal completion containing a Time Zone Identifier Parse Record, or a throw completion
1710
1740
</h1>
1711
1741
<dlclass="header">
1712
1742
<dt>description</dt>
1713
1743
<dd>
1714
1744
It parses the argument as either a time zone identifier or an ISO 8601 / RFC 9557 string.
1715
1745
The returned Record's fields are set as follows:
1716
1746
<ul>
1717
-
<li>If _timeZoneString_ is a named time zone identifier, then [[Name]] is _timeZoneString_ and [[OffsetMinutes]] is ~empty~.</li>
1718
-
<li>Otherwise, if _timeZoneString_ is an offset time zone identifier, then [[OffsetMinutes]] is a signed integer and [[Name]] is ~empty~.</li>
1719
-
<li>Otherwise, if _timeZoneString_ is a string with a time zone annotation containing a named time zone identifier, then [[Name]] is the time zone identifier contained in the annotation and [[OffsetMinutes]] is ~empty~.</li>
1720
-
<li>Otherwise, if _timeZoneString_ is a string with a time zone annotation containing an offset time zone identifier, then [[OffsetMinutes]] is a signed integer and [[Name]] is ~empty~.</li>
1721
-
<li>Otherwise, if _timeZoneString_ is a string using a *Z* offset designator, then [[Name]] is *"UTC"* and [[OffsetMinutes]] is ~empty~.</li>
1722
-
<li>Otherwise, if _timeZoneString_ is a string using a numeric UTC offset, then [[OffsetMinutes]] is a signed integer and [[Name]] is ~empty~.</li>
1747
+
<li>If _timeZoneString_ is a named time zone identifier, then [[Name]] is _timeZoneString_.</li>
1748
+
<li>Otherwise, if _timeZoneString_ is an offset time zone identifier, then [[OffsetMinutes]] is the time zone's UTC offset.</li>
1749
+
<li>Otherwise, if _timeZoneString_ is a string with a time zone annotation containing a named time zone identifier, then [[Name]] is the time zone identifier contained in the annotation.</li>
1750
+
<li>Otherwise, if _timeZoneString_ is a string with a time zone annotation containing an offset time zone identifier, then [[OffsetMinutes]] is the time zone's UTC offset.</li>
1751
+
<li>Otherwise, if _timeZoneString_ is a string using a *Z* offset designator, then [[Name]] is *"UTC"*.</li>
1752
+
<li>Otherwise, if _timeZoneString_ is a string using a numeric UTC offset, then [[OffsetMinutes]] is that numeric UTC offset.</li>
Copy file name to clipboardExpand all lines: spec/timezone.html
+4-7Lines changed: 4 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -418,14 +418,12 @@ <h1>
418
418
<h1>
419
419
ParseTimeZoneIdentifier (
420
420
_identifier_: a String,
421
-
): either a normal completion containing a Record with fields [[Name]] (a named time zone identifier or ~empty~) and [[OffsetMinutes]] (an integer or ~empty~), or a throw completion
421
+
): either a normal completion containing a Time Zone Identifier Parse Record, or a throw completion
422
422
</h1>
423
423
<dlclass="header">
424
424
<dt>description</dt>
425
425
<dd>
426
-
If _identifier_ is a named time zone identifier, [[Name]] will be _identifier_ and [[OffsetMinutes]] will be ~empty~.
427
-
If _identifier_ is an offset time zone identifier, [[Name]] will be ~empty~ and [[OffsetMinutes]] will be a signed integer.
428
-
Otherwise, a *RangeError* will be thrown.
426
+
It parses _identifier_ to determine whether it identifies an offset time zone or named time zone. If _identifier_ is syntactically invalid, a *RangeError* will be thrown.
429
427
</dd>
430
428
</dl>
431
429
<emu-alg>
@@ -434,14 +432,13 @@ <h1>
434
432
1. If _parseResult_ contains a |TimeZoneIANAName| Parse Node, then
435
433
1. Let _name_ be the source text matched by the |TimeZoneIANAName| Parse Node contained within _parseResult_.
436
434
1. NOTE: _name_ is syntactically valid, but does not necessarily conform to <ahref="https://data.iana.org/time-zones/theory.html#naming">IANA Time Zone Database naming guidelines</a> or correspond with an available named time zone identifier.
437
-
1. Return the Record { [[Name]]: CodePointsToString(_name_), [[OffsetMinutes]]: ~empty~ }.
435
+
1. Return Time Zone Identifier Parse Record { [[Name]]: CodePointsToString(_name_), [[OffsetMinutes]]: ~empty~ }.
438
436
1. Else,
439
437
1.Assert:_parseResult_ contains a |UTCOffset[~SubMinutePrecision]| Parse Node.
440
438
1. Let _offset_ be the source text matched by the |UTCOffset[~SubMinutePrecision]| Parse Node contained within _parseResult_.
441
439
1. Let _offsetNanoseconds_ be ! ParseDateTimeUTCOffset(CodePointsToString(_offset_)).
442
440
1. Let _offsetMinutes_ be _offsetNanoseconds_ / (60 × 10<sup>9</sup>).
443
-
1.Assert:_offsetMinutes_ is an integer.
444
-
1. Return the Record { [[Name]]: ~empty~, [[OffsetMinutes]]: _offsetMinutes_ }.
441
+
1. Return Time Zone Identifier Parse Record { [[Name]]: ~empty~, [[OffsetMinutes]]: _offsetMinutes_ }.
0 commit comments