Skip to content

Commit e7f1e5d

Browse files
justingrantljharb
authored andcommitted
Normative: Revert U+2212 in timezone offsets (#3334)
Following ISO-8601, #2781 introduced U+2212 (Unicode minus) as an alias for the regular ASCII minus sign for use in time zone offsets. There's two new data that lead me to believe that this was a mistake, and that we should revert this change. The first is that the newly-released RFC 9557 (the string format standard that Temporal uses) disallows non-ASCII characters. Its predecessor RFC 3339 also disallows non-ASCII characters. So strings that follow the current (since 2022) ECMAScript spec could be rejected by RFC 9557 clients. The second new data is feedback from implementers of a Rust version of Temporal that this single obscure character in the grammar will incur a performance cost because they must now use Rust strings instead of plain U8 ASCII data. See tc39/proposal-temporal#2843 (comment) This performance issue doesn't seem to be limited to Rust. Any native implementation would likely benefit from being able to know that valid date/time input (both Date and Temporal) is always ASCII-only. I don't know whether all engines have actually implemented this 2022 grammar change. But it's also a safe bet that real-world usage of this Unicode character is likely minimal. So the web-compat risk seems small. If this PR is accepted, then we'll follow up with a normative Temporal PR to remove this character from Temporal as well.
1 parent 7a23e0e commit e7f1e5d

File tree

1 file changed

+6
-41
lines changed

1 file changed

+6
-41
lines changed

spec.html

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33183,48 +33183,14 @@ <h1>Time Zone Offset String Format</h1>
3318333183
<p>
3318433184
ECMAScript defines a string interchange format for UTC offsets, derived from ISO 8601.
3318533185
The format is described by the following grammar.
33186-
The usage of Unicode code points in this grammar is listed in <emu-xref href="#table-time-zone-offset-string-code-points"></emu-xref>.
3318733186
</p>
3318833187

33189-
<emu-table id="table-time-zone-offset-string-code-points" caption="Time Zone Offset String Code Points">
33190-
<table>
33191-
<thead>
33192-
<tr>
33193-
<th>
33194-
Code Point
33195-
</th>
33196-
<th>
33197-
Unicode Name
33198-
</th>
33199-
<th>
33200-
Abbreviation
33201-
</th>
33202-
</tr>
33203-
</thead>
33204-
<tr>
33205-
<td>
33206-
`U+2212`
33207-
</td>
33208-
<td>
33209-
MINUS SIGN
33210-
</td>
33211-
<td>
33212-
&lt;MINUS>
33213-
</td>
33214-
</tr>
33215-
</table>
33216-
</emu-table>
33217-
3321833188
<h2>Syntax</h2>
3321933189
<emu-grammar type="definition">
3322033190
UTCOffset :::
33221-
TemporalSign Hour
33222-
TemporalSign Hour HourSubcomponents[+Extended]
33223-
TemporalSign Hour HourSubcomponents[~Extended]
33224-
33225-
TemporalSign :::
33226-
ASCIISign
33227-
&lt;MINUS&gt;
33191+
ASCIISign Hour
33192+
ASCIISign Hour HourSubcomponents[+Extended]
33193+
ASCIISign Hour HourSubcomponents[~Extended]
3322833194

3322933195
ASCIISign ::: one of
3323033196
`+` `-`
@@ -33298,9 +33264,9 @@ <h1>
3329833264
<emu-alg>
3329933265
1. Let _parseResult_ be ParseText(_offsetString_, |UTCOffset|).
3330033266
1. Assert: _parseResult_ is not a List of errors.
33301-
1. Assert: _parseResult_ contains a |TemporalSign| Parse Node.
33302-
1. Let _parsedSign_ be the source text matched by the |TemporalSign| Parse Node contained within _parseResult_.
33303-
1. If _parsedSign_ is the single code point U+002D (HYPHEN-MINUS) or U+2212 (MINUS SIGN), then
33267+
1. Assert: _parseResult_ contains a |ASCIISign| Parse Node.
33268+
1. Let _parsedSign_ be the source text matched by the |ASCIISign| Parse Node contained within _parseResult_.
33269+
1. If _parsedSign_ is the single code point U+002D (HYPHEN-MINUS), then
3330433270
1. Let _sign_ be -1.
3330533271
1. Else,
3330633272
1. Let _sign_ be 1.
@@ -50091,7 +50057,6 @@ <h1>Number Conversions</h1>
5009150057
<emu-annex id="sec-time-zone-offset-string-format">
5009250058
<h1>Time Zone Offset String Format</h1>
5009350059
<emu-prodref name="UTCOffset"></emu-prodref>
50094-
<emu-prodref name="TemporalSign"></emu-prodref>
5009550060
<emu-prodref name="ASCIISign"></emu-prodref>
5009650061
<emu-prodref name="Hour"></emu-prodref>
5009750062
<emu-prodref name="HourSubcomponents"></emu-prodref>

0 commit comments

Comments
 (0)