Skip to content

Commit

Permalink
Editorial: Introduce an SDO for checking legacy time zone names
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 authored and ptomato committed Jun 13, 2023
1 parent 076f287 commit 8b94fd6
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions spec/abstractops.html
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,6 @@ <h1>ISO 8601 grammar</h1>
ASCIISign
U+2212

UnpaddedHour :
Hour[~Padded]

Hour[Padded] :
[~Padded] DecimalDigit
[+Padded] `0` DecimalDigit
Expand Down Expand Up @@ -1144,8 +1141,7 @@ <h1>ISO 8601 grammar</h1>

TimeZoneIANAName :
TimeZoneIANANameTail[~Legacy]
TimeZoneIANANameTail[+Legacy] [&gt; but only if `etc/gmt` |ASCIISign| |UnpaddedHour| matches the ASCII-lowercase of the sequence of code points matched by (|TimeZoneIANANameTail|)]
TimeZoneIANANameTail[+Legacy] [&gt; but only if the sequence of code points matched by |TimeZoneIANANameTail| is an ASCII-case-insensitive match for an element of « *"Etc/GMT0"*, *"GMT0"*, *"GMT-0"*, *"GMT+0"*, *"EST5EDT"*, *"CST6CDT"*, *"MST7MDT"*, *"PST8PDT"* »]
TimeZoneIANANameTail[+Legacy] [> but only if IsLegacyIANATimeZoneName of |TimeZoneIANANameTail| is *true*]

TimeZoneIdentifier :
TimeZoneIANAName
Expand Down Expand Up @@ -1309,8 +1305,8 @@ <h1>ISO 8601 grammar</h1>
DateTime TimeZoneAnnotation Annotations?
</emu-grammar>

<emu-clause id="sec-temporal-iso8601grammar-early-errors">
<h1>Early errors</h1>
<emu-clause id="sec-temporal-iso8601grammar-static-semantics-early-errors">
<h1>Static Semantics: Early Errors</h1>
<emu-grammar>
DateYear :
Sign DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit
Expand All @@ -1321,6 +1317,31 @@ <h1>Early errors</h1>
</li>
</ul>
</emu-clause>

<emu-clause id="sec-temporal-iso8601grammar-static-semantics-islegacyianatimezonename" type="sdo">
<h1>Static Semantics: IsLegacyIANATimeZoneName ( ): a Boolean</h1>
<dl class="header">
</dl>
<emu-note>
<p>The IANA Time Zone Database naming guidelines do not allow digits in new named time zone identifiers, but legacy exceptions remain as described at <a href="https://data.iana.org/time-zones/theory.html">Theory and pragmatics of the tz code and data</a>. In addition to specific names mentioned there, this specification also recognizes all time zone identifiers consisting of *"Etc/GMT-"* or *"Etc/GMT+"* followed by an unpadded count of hours less than 24 as syntactically valid, even those that are not currently included in the IANA Time Zone Database (but does not require any such identifier to be an available named time zone identifier).</p>
</emu-note>
<emu-grammar>
TimeZoneIANANameTail[Legacy] :
TimeZoneIANANameComponent[?Legacy]
TimeZoneIANANameComponent[?Legacy] `/` TimeZoneIANANameTail[?Legacy]
</emu-grammar>
<emu-alg>
1. Let _name_ be the source text matched by |TimeZoneIANANameTail|.
1. Let _nameStr_ be CodePointsToString(_name_).
1. For each String _legacyName_ of « *"Etc/GMT0"*, *"GMT0"*, *"GMT-0"*, *"GMT+0"*, *"EST5EDT"*, *"CST6CDT"*, *"MST7MDT"*, *"PST8PDT"* », do
1. If _nameStr_ is an ASCII-case-insensitive match for _legacyName_, return *true*.
1. If the length of _nameStr_ &lt; 9, return *false*.
1. If the substring of _nameStr_ from 0 to 8 is not an ASCII-case-insensitive match for *"Etc/GMT-"* or *"Etc/GMT+"*, return *false*.
1. Let _hour_ be the substring of _nameStr_ from 8.
1. If ParseText(_hour_, |Hour[~Padded]|) is a List of errors, return *false*.
1. Return *true*.
</emu-alg>
</emu-clause>
</emu-clause>

<emu-clause id="sec-temporal-parseisodatetime" type="abstract operation">
Expand Down

0 comments on commit 8b94fd6

Please sign in to comment.