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: Refactor time zone identifier spec text
This commit builds on the new ECMA-262 text for time zone identifiers
that was introduced in tc39/ecma262#3035.
This commit adds Temporal-specific AOs and makes a handful of
edits to ECMA-262 AOs for changes that didn't apply to %Date% but that
will be required after Temporal is merged into ECMA-262.
This commit also revises the ASCII-case-insensitive section to address
feedback from ECMA-262 editors before this text was removed from
tc39/ecma262#3035:
* Remove the "sequence of code points" info because only Strings seemed
to use these definitions.
* Minor wordsmithing, e.g. "string value" => "String"
@@ -8,6 +8,7 @@ <h1>Amendments to the ECMAScript® 2023 Internationalization API Specification</
8
8
<p>
9
9
This section lists amendments which must be made to <ahref="https://tc39.es/ecma402/">ECMA-402, the ECMAScript® 2023 Internationalization API Specification</a>.
10
10
Text to be added is marked <ins>like this</ins>, and text to be deleted is marked <del>like this</del>.
11
+
Blocks of unmodified text between modified sections are marked by [...].
11
12
</p>
12
13
<p>
13
14
This text is based on top of the ECMA-402 spec text from commit <ahref="https://github.com/tc39/ecma402/commit/eb81befe8b739f976a3d6e68ec567302c4e217f0">eb81befe8b739f976a3d6e68ec567302c4e217f0</a>.
<emu-notetype="editor">This section replaces the <ahref="https://tc39.es/ecma-402/#sec-time-zone-names">Time Zone Names</a> section in ECMA-402.</emu-note>
49
+
<p>
50
+
Implementations that adopt the ECMAScript Internationalization API Specification are time zone aware: they use the IANA Time Zone Database <ahref="https://www.iana.org/time-zones/">https://www.iana.org/time-zones/</a> to supply time zone identifiers and data used in ECMAScript calculations and formatting.
51
+
This section defines how the IANA Time Zone Database should be used by time zone aware implementations.
52
+
</p>
53
+
<p>
54
+
Except as overridden by AvailableNamedTimeZoneIdentifiers, each Zone in the IANA Time Zone Database must be a primary time zone identifier and each Link name in the IANA Time Zone Database must be a non-primary time zone identifier.
55
+
No String may be an available named time zone identifier unless it is a Zone name or a Link name in the IANA Time Zone Database.
56
+
Available named time zone identifiers returned by ECMAScript built-in objects must use the casing found in the IANA Time Zone Database.
57
+
</p>
58
+
<p>
59
+
In the IANA Time Zone Database, the UTC time zone is represented by the Zone *"Etc/UTC"* which is distinct from the Zone *"Etc/GMT"*.
60
+
For historical reasons, ECMAScript uses *"UTC"* as the primary identifier for the former Zone and does not recognize the latter Zone as distinct, instead requiring *"Etc/UTC"*, *"Etc/GMT"*, and *"GMT"* (if available) to be non-primary identifiers that resolve to *"UTC"*.
61
+
This is the only deviation from the IANA Time Zone Database that is required of a time zone aware ECMAScript implementation.
62
+
</p>
63
+
<p>
64
+
The IANA Time Zone Database is typically updated between five and ten times per year.
65
+
These updates may add new Zone or Link names, may change Zones to Links, and may change the UTC offsets and transitions associated with any Zone.
66
+
ECMAScript implementations are recommended to include updates to the IANA Time Zone Database as soon as possible.
67
+
Such prompt action ensures that ECMAScript programs can accurately perform time-zone-sensitive calculations and can use newly-added available named time zone identifiers supplied by external input or the host environment.
68
+
</p>
69
+
<p>
70
+
If implementations revise time zone information during the lifetime of an agent, then which identifiers are supported, the primary time zone identifier associated with any identifier, and the UTC offsets and transitions associated with any Zone, must be consistent with results previously observed by that agent.
71
+
Due to the complexity of supporting this requirement, it is recommended that implementations maintain a fully consistent copy of the IANA Time Zone Database for the lifetime of each agent.
72
+
</p>
73
+
74
+
<p>This section complements but does not supersede <emu-xrefhref="#sec-time-zone-identifiers"></emu-xref>.</p>
75
+
76
+
<emu-note>
47
77
<p>
48
-
<emu-xrefhref="#sec-time-zone-names"></emu-xref> defines a set of abstract operations concerning the names of supported time zones.
49
-
This section introduces additional requirements on these operations for implementations.
78
+
The IANA Time Zone Database offers build options that affect which time zone identifiers are primary.
79
+
The default build options merge different countries' time zones, for example *"Atlantic/Reykjavik"* being a Link to the Zone *"Africa/Abidjan"*.
80
+
Geographically and politically distinct locations are likely to introduce divergent time zone rules in a future version of the IANA Time Zone Database.
81
+
Therefore, it is recommended that ECMAScript implementations instead use build options such as <code>PACKRATDATA=backzone PACKRATLIST=zone.tab</code> or a similar alternative that ensures at least one primary identifier for each <ahref="https://www.iso.org/glossary-for-iso-3166.html">ISO 3166-1 Alpha-2</a> country code.
<h1>AvailableNamedTimeZoneIdentifiers ( ): a List of Time Zone Identifier Records</h1>
87
+
<dlclass="header">
88
+
<dt>description</dt>
89
+
<dd>
90
+
Its result describes all available named time zone identifiers in this implementation, as well as the primary time zone identifier corresponding to each available named time zone identifier.
91
+
The List is ordered according to the [[Identifier]] field of each Time Zone Identifier Record.
92
+
</dd>
93
+
<dt>redefinition</dt>
94
+
<dd>true</dd>
95
+
</dl>
96
+
<p>This definition supersedes the definition provided in <emu-xrefhref="#sec-availablenamedtimezoneidentifiers"></emu-xref>.</p>
97
+
<emu-alg>
98
+
1. Let _identifiers_ be a List containing the String value of each Zone or Link name in the IANA Time Zone Database.
99
+
1.Assert: No element of _identifiers_ is an ASCII-case-insensitive match for any other element.
100
+
1.Assert: Every element of _identifiers_ identifies a Zone or Link name in the IANA Time Zone Database.
101
+
1. Set _identifiers_ to SortStringListByCodeUnit(_identifiers_).
102
+
1. Let _result_ be a new empty List.
103
+
1. For each element _identifier_ of _identifiers_, do
104
+
1. Let _primary_ be _identifier_.
105
+
1. If _identifier_ is a non-primary time zone identifier and _identifier_ is not *"UTC"*, then
106
+
1. Set _primary_ to the name of the primary time zone identifier that _identifier_ resolves to, according to the rules for resolving Link names in the IANA Time Zone Database.
107
+
1. NOTE: An implementation may need to resolve _identifier_ iteratively to obtain the primary time zone identifier.
108
+
1. If _primary_ is one of *"Etc/UTC"*, *"Etc/GMT"*, or *"GMT"*, set _primary_ to *"UTC"*.
109
+
1. Let _record_ be the Time Zone Identifier Record { [[Identifier]]: _identifier_, [[PrimaryIdentifier]]: _primary_ }.
110
+
1. Append _record_ to _result_.
111
+
1.Assert:_result_ contains a Time Zone Identifier Record _r_ such that _r_.[[Identifier]] is *"UTC"* and _r_.[[PrimaryIdentifier]] is *"UTC"*.
112
+
1. Return _result_.
113
+
</emu-alg>
114
+
115
+
<emu-note>
116
+
Time zone identifiers in the IANA Time Zone Database can change over time.
117
+
At a minimum, it is recommended that implementations limit changes to the result of AvailableNamedTimeZoneIdentifiers to the changes allowed by GetAvailableNamedTimeZoneIdentifier, for the lifetime of the surrounding agent.
118
+
Due to the complexity of supporting these recommendations, it is recommended that the result of AvailableNamedTimeZoneIdentifiers remains the same for the lifetime of the surrounding agent.
119
+
</emu-note>
120
+
</emu-clause>
121
+
</emu-clause>
122
+
</ins>
123
+
124
+
<delclass="block">
125
+
<emu-clauseid="sec-time-zone-names-deleted">
126
+
<h1>Time Zone Names</h1>
52
127
53
128
<p>
54
129
The ECMAScript 2023 Internationalization API Specification identifies time zones using the Zone and Link names of the IANA Time Zone Database. Their canonical form is the corresponding Zone name in the casing used in the IANA Time Zone Database except as specifically overridden by CanonicalizeTimeZoneName.
@@ -58,70 +133,71 @@ <h1><a href="https://tc39.es/ecma402/#sec-time-zone-names">Time Zone Names</a></
58
133
A conforming implementation must recognize *"UTC"* and all other Zone and Link names (and <strong>only</strong> such names), and use best available current and historical information about their offsets from UTC and their daylight saving time rules in calculations. However, the set of combinations of time zone name and language tag for which localized time zone names are available is implementation dependent.
The abstract operation IsValidTimeZoneName takes argument _timeZone_, a String value, and verifies that it represents a valid Zone or Link name of the IANA Time Zone Database.
67
-
</p>
139
+
<p>
140
+
The abstract operation IsValidTimeZoneName takes argument _timeZone_, a String value, and verifies that it represents a valid Zone or Link name of the IANA Time Zone Database.
141
+
</p>
68
142
69
-
<emu-alg>
70
-
1. If one of the Zone or Link names of the IANA Time Zone Database is an ASCII-case-insensitive match of _timeZone_, return *true*.
71
-
1. If _timeZone_ is an ASCII-case-insensitive match of *"UTC"*, return *true*.
72
-
1. Return *false*.
73
-
</emu-alg>
74
-
</emu-clause>
75
-
</del>
143
+
<emu-alg>
144
+
1. If one of the Zone or Link names of the IANA Time Zone Database is an ASCII-case-insensitive match of _timeZone_, return *true*.
145
+
1. If _timeZone_ is an ASCII-case-insensitive match of *"UTC"*, return *true*.
_timeZone_: a String value that is <del>a valid</del><ins>an available</ins> time zone name as verified by <del>IsValidTimeZoneName</del><ins>IsAvailableTimeZoneName</ins>,
153
+
_timeZone_: a String value that is a validtime zone name as verified by IsValidTimeZoneName,
81
154
)
82
155
</h1>
83
156
<dlclass="header">
84
157
<dt>description</dt>
85
158
<dd>It returns the canonical and case-regularized form of _timeZone_.</dd>
86
-
<dt>redefinition</dt>
87
-
<dd>true</dd>
88
159
</dl>
89
-
90
160
<emu-alg>
91
161
1. Let _ianaTimeZone_ be the String value of the Zone or Link name of the IANA Time Zone Database that is an ASCII-case-insensitive match of _timeZone_.
92
162
1. If _ianaTimeZone_ is a Link name, let _ianaTimeZone_ be the String value of the corresponding Zone name as specified in the file <code>backward</code> of the IANA Time Zone Database.
93
163
1. If _ianaTimeZone_ is *"Etc/UTC"* or *"Etc/GMT"*, return *"UTC"*.
94
164
1. Return _ianaTimeZone_.
95
165
</emu-alg>
166
+
</emu-clause>
96
167
97
-
<insclass="block">
98
-
<p>This definition supersedes the definition provided in <emu-xrefhref="#sec-canonicalizetimezonename"></emu-xref>.</p>
<dd>It returns a String value representing the host environment's current time zone, which is a valid (<emu-xrefhref="#sec-isvalidtimezonename"></emu-xref>) and canonicalized (<emu-xrefhref="#sec-canonicalizetimezonename"></emu-xref>) time zone name.</dd>
174
+
</dl>
175
+
176
+
<p>
177
+
This definition supersedes the definition provided in es2024, <emu-xrefhref="#sec-systemtimezoneidentifier"></emu-xref>.
<dd>The returned List is a sorted List of supported Zone and Link names in the IANA Time Zone Database.</dd>
111
-
<dt>redefinition</dt>
112
-
<dd>true</dd>
113
-
</dl>
114
-
<emu-alg>
115
-
1. Let _timeZones_ be a List containing the String value of each Zone or Link name in the IANA Time Zone Database that is supported by the implementation.
116
-
1.Assert:_timeZones_ contains *"UTC"*.
117
-
1.Assert:_timeZones_ does not contain any element that does not identify a Zone or Link name in the IANA Time Zone Database.
<dd>The returned List is a sorted List of supported Zone and Link names in the IANA Time Zone Database.</dd>
189
+
</dl>
190
+
<emu-alg>
191
+
1. Let _timeZones_ be a List containing the String value of each Zone or Link name in the IANA Time Zone Database that is supported by the implementation.
192
+
1.Assert:_timeZones_ contains *"UTC"*.
193
+
1.Assert:_timeZones_ does not contain any element that does not identify a Zone or Link name in the IANA Time Zone Database.
194
+
1. Return SortStringListByCodeUnit(_timeZones_).
195
+
</emu-alg>
120
196
121
-
<p>This definition supersedes the definition provided in <emu-xrefhref="#sec-availabletimezones"></emu-xref>.</p>
122
-
</emu-clause>
123
-
</ins>
197
+
<p>This definition supersedes the definition provided in [removed].</p>
In this version of the ECMAScript 2023 Internationalization API, the *"timeZone"* property will be the name of the default time zone if no *"timeZone"* property was provided in the options object provided to the Intl.DateTimeFormat constructor. The first edition left the *"timeZone"* property *undefined* in this case.
1355
+
In this version of the ECMAScript Internationalization API, the *"timeZone"* property will be the name of the system time zone identifier if no *"timeZone"* property was provided in the options object provided to the Intl.DateTimeFormat constructor.
1356
+
The first edition left the *"timeZone"* property *undefined* in this case.
0 commit comments