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
Rename "canonical" to "primary" tz identifier term
We were concerned that "canonical time zone identifier" is too strong,
and that a less-prescriptive term may work better. This is broken out
into a separate commit in case we (or others on TC39) want to revert to
the previous "canonical" term.
Copy file name to clipboardExpand all lines: spec.html
+23-23Lines changed: 23 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -32101,11 +32101,11 @@ <h1>Time Zone Identifiers</h1>
32101
32101
ECMAScript identifies time zones using the Zone and Link names of the IANA Time Zone Database <a href="https://www.iana.org/time-zones/">https://www.iana.org/time-zones/</a>.
32102
32102
These names are called <dfn variants="time zone identifier">time zone identifiers</dfn>, and are Strings composed entirely of characters from the Basic Latin Unicode block.
32103
32103
Time zone identifiers are case-insensitive and so are compared using ASCII case-insensitive comparisons, but time zone identifiers returned by ECMAScript built-in objects always use the casing found in the IANA Time Zone Database.
32104
-
A <dfn id="canonical-time-zone-identifier" variants="canonical time zone identifiers">canonical time zone identifier</dfn> is a Zone name, and a <dfn variants="non-canonical time zone identifiers">non-canonical time zone identifier</dfn> is a Link name, respectively, in the IANA Time Zone Database except as specifically overridden by AvailableTimeZoneIdentifiers.
32104
+
A <dfn id="primary-time-zone-identifier" variants="primary time zone identifiers">primary time zone identifier</dfn> is a Zone name, and a <dfn variants="non-primary time zone identifiers">non-primary time zone identifier</dfn> is a Link name, respectively, in the IANA Time Zone Database except as specifically overridden by AvailableTimeZoneIdentifiers.
32105
32105
The set of Zone and Link identifiers that are supported by an ECMAScript implementation are called available time zone identifiers.
32106
32106
</p>
32107
32107
32108
-
<p>In the IANA Time Zone Database, the UTC time zone is represented by the Zone *"Etc/UTC"*, but for backwards compatibility and brevity reasons, *"UTC"* is the canonical identifier used for this time zone in ECMAScript, while *"Etc/UTC"*, *"GMT"*, and *"Etc/GMT"* are all non-canonical identifiers that resolve to *"UTC"*.</p>
32108
+
<p>In the IANA Time Zone Database, the UTC time zone is represented by the Zone *"Etc/UTC"*, but for backwards compatibility and brevity reasons, *"UTC"* is the primary identifier used for this time zone in ECMAScript, while *"Etc/UTC"*, *"GMT"*, and *"Etc/GMT"* are all non-primary identifiers that resolve to *"UTC"*.</p>
32109
32109
32110
32110
<p>
32111
32111
<dfn id="time-zone-aware">Time zone aware</dfn> ECMAScript implementations support *"UTC"* and local political rules of time zones represented by all other Zone and Link names (and <strong>only</strong> such names) from the IANA Time Zone Database.
@@ -32114,7 +32114,7 @@ <h1>Time Zone Identifiers</h1>
32114
32114
Fruthermore, even non-time zone aware implementations that do not support the entire IANA Time Zone Database are still recommended to use IANA Time Zone Database identifiers to represent time zones.
32115
32115
</p>
32116
32116
32117
-
<p>ECMAScript implementations that do not include local political rules for any time zones must support at least one available time zone identifier, *"UTC"*, which must be canonical.</p>
32117
+
<p>ECMAScript implementations that do not include local political rules for any time zones must support at least one available time zone identifier, *"UTC"*, which must be primary.</p>
32118
32118
32119
32119
<p>
32120
32120
Time zone identifiers in the IANA Time Zone Database can change over time.
@@ -32124,21 +32124,21 @@ <h1>Time Zone Identifiers</h1>
32124
32124
32125
32125
<p>
32126
32126
The IANA Time Zone Database is typically updated between five and ten times per year, so it is recommended to use the best available current and historical time zone information.
32127
-
This information includes which identifiers are supported, the canonical time zone identifier associated with any identifier, and the UTC offsets and transitions associated with any Zone.
32127
+
This information includes which identifiers are supported, the primary time zone identifier associated with any identifier, and the UTC offsets and transitions associated with any Zone.
32128
32128
</p>
32129
32129
32130
32130
<p>
32131
32131
When time zone information is updated, it is recommended that implementations maintain a fully consistent copy of the IANA Time Zone Database for the lifetime of each agent.
32132
-
If implementations do revise time zone information during the lifetime of an agent, then it is recommended that changes to time zone data, including which identifiers are supported, the canonical time zone identifier associated with any identifier, and the UTC offsets and transitions associated with any Zone, can be incorporated into an agent only if they are consistent with results already observed by all ECMAScript code that can reach that agent.
32133
-
For example, it is recommended that a new identifier can be incorporated only if no ECMAScript code has already tried to use it, and it is recommended that replacement of a canonical identifier with a Link to a different identifier can only be incorporated only if no ECMAScript code has already resulted in resolving it as canonical.
32132
+
If implementations do revise time zone information during the lifetime of an agent, then it is recommended that changes to time zone data, including which identifiers are supported, the primary time zone identifier associated with any identifier, and the UTC offsets and transitions associated with any Zone, can be incorporated into an agent only if they are consistent with results already observed by all ECMAScript code that can reach that agent.
32133
+
For example, it is recommended that a new identifier can be incorporated only if no ECMAScript code has already tried to use it, and it is recommended that replacement of a primary identifier with a Link to a different identifier can only be incorporated only if no ECMAScript code has already resulted in resolving it as primary.
32134
32134
The complexity of maintaining such invariants is why it is recommended that implementations maintain a fully consistent copy of the IANA Time Zone Database for the lifetime of each agent.
32135
32135
</p>
32136
32136
32137
32137
<p>
32138
-
The IANA Time Zone Database offers build options that affect which time zone identifiers are canonical.
32139
-
It is recommended that ECMAScript implementations <strong>should not</strong> determine which identifiers are canonical and non-canonical using the data generated by the default build options of the IANA Time Zone Database, because those default build options merge geographically unrelated time zones together, such as *"Atlantic/Reykjavik"* as a Link to the Zone *"Africa/Abidjan"*.
32138
+
The IANA Time Zone Database offers build options that affect which time zone identifiers are primary.
32139
+
It is recommended that ECMAScript implementations <strong>should not</strong> determine which identifiers are primary and non-primary using the data generated by the default build options of the IANA Time Zone Database, because those default build options merge geographically unrelated time zones together, such as *"Atlantic/Reykjavik"* as a Link to the Zone *"Africa/Abidjan"*.
32140
32140
These merges can be problematic because geographically and politically distinct locations, especially across country boundaries, are more likely to introduce divergent time zone rules in a future version of the IANA Time Zone Database.
32141
-
Therefore, it is recommended that all identifiers listed in the IANA Time Zone Database's <code>zone.tab</code> file (which lists at least one Link or Zone name for each <a href="https://www.iso.org/glossary-for-iso-3166.html">ISO 3166-1 Alpha-2</a> country code in the IANA Time Zone Database) should be canonical identifiers.
32141
+
Therefore, it is recommended that all identifiers listed in the IANA Time Zone Database's <code>zone.tab</code> file (which lists at least one Link or Zone name for each <a href="https://www.iso.org/glossary-for-iso-3166.html">ISO 3166-1 Alpha-2</a> country code in the IANA Time Zone Database) should be primary identifiers.
32142
32142
One way to achieve this result is to build the IANA Time Zone Database with the <code>PACKRATDATA=backzone PACKRATLIST=zone.tab</code> build options.
AvailableTimeZoneIdentifiers (): a List of Records with fields [[Identifier]] (a String value that is a time zone identifier) and [[CanonicalIdentifier]] (a String value that is a canonical time zone identifier)
32207
+
AvailableTimeZoneIdentifiers (): a List of Records with fields [[Identifier]] (a String value that is a time zone identifier) and [[PrimaryIdentifier]] (a String value that is a primary time zone identifier)
32208
32208
</h1>
32209
32209
<dl class="header">
32210
32210
<dt>description</dt>
32211
32211
<dd>
32212
-
It returns a List of Records describing all available time zone identifiers in this implementation, as well as the canonical time zone identifier corresponding to each available identifier.
32212
+
It returns a List of Records describing all available time zone identifiers in this implementation, as well as the primary time zone identifier corresponding to each available identifier.
32213
32213
The List is sorted by [[Identifier]].
32214
-
If an identifier is <emu-xref href="#canonical-time-zone-identifier">canonical</emu-xref>, then [[Identifier]] will be [[CanonicalIdentifier]].
32214
+
If an identifier is <emu-xref href="#primary-time-zone-identifier">primary</emu-xref>, then [[Identifier]] will be [[PrimaryIdentifier]].
32215
32215
</dd>
32216
32216
</dl>
32217
32217
@@ -32222,14 +32222,14 @@ <h1>
32222
32222
1. [declared="comparefn"] Sort _identifiers_ in order as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_.
32223
32223
1. Let _result_ be an empty List.
32224
32224
1. For each element _identifier_ of _identifiers_, do
32225
-
1. Let _canonical_ be _identifier_.
32226
-
1. If _identifier_ is a non-canonical time zone identifier and _identifier_ is not *"UTC"*, then
32227
-
1. Set _canonical_ to the name of the canonical time zone identifier that _identifier_ resolves to in the IANA Time Zone Database.
32228
-
1. NOTE: If _identifier_ resolves to another non-canonical time zone identifier, then the implementation must continue resolution of the entire chain until its terminal canonical time zone identifier.
32229
-
1. If _canonical_ is one of *"Etc/UTC"*, *"Etc/GMT"*, or *"GMT"*, set _canonical_ to *"UTC"*.
32230
-
1. Let _record_ be the Record { [[Identifier]]: _identifier_, [[CanonicalIdentifier]]: _canonical_ }.
32225
+
1. Let _primary_ be _identifier_.
32226
+
1. If _identifier_ is a non-primary time zone identifier and _identifier_ is not *"UTC"*, then
32227
+
1. Set _primary_ to the name of the primary time zone identifier that _identifier_ resolves to in the IANA Time Zone Database.
32228
+
1. NOTE: If _identifier_ resolves to another non-primary time zone identifier, then the implementation must continue resolution of the entire chain until its terminal primary time zone identifier.
32229
+
1. If _primary_ is one of *"Etc/UTC"*, *"Etc/GMT"*, or *"GMT"*, set _primary_ to *"UTC"*.
32230
+
1. Let _record_ be the Record { [[Identifier]]: _identifier_, [[PrimaryIdentifier]]: _primary_ }.
32231
32231
1. Append _record_ to the end of _result_.
32232
-
1. Assert: One element of _result_ is { [[Identifier]]: *"UTC"*, [[CanonicalIdentifier]]: *"UTC"* }.
32232
+
1. Assert: One element of _result_ is { [[Identifier]]: *"UTC"*, [[PrimaryIdentifier]]: *"UTC"* }.
32233
32233
1. Return _result_.
32234
32234
</emu-alg>
32235
32235
@@ -32245,7 +32245,7 @@ <h1>HostTimeZoneIdentifier ( ): a String</h1>
32245
32245
<dl class="header">
32246
32246
<dt>description</dt>
32247
32247
<dd>
32248
-
It returns a String value representing the host environment's current time zone, which is either a String representing a UTC offset for which IsTimeZoneOffsetString returns *true*, or a canonical time zone identifier.
32248
+
It returns a String value representing the host environment's current time zone, which is either a String representing a UTC offset for which IsTimeZoneOffsetString returns *true*, or a primary time zone identifier.
32249
32249
</dd>
32250
32250
</dl>
32251
32251
@@ -32254,7 +32254,7 @@ <h1>HostTimeZoneIdentifier ( ): a String</h1>
32254
32254
1. Let _hostTimeZoneString_ be the string representing the host environment's current time zone, either a time zone identifier or a UTC offset string.
32255
32255
1. If IsTimeZoneOffsetString(_hostTimeZoneString_) is *true*, return _hostTimeZoneString_.
32256
32256
1. Assert: GetAvailableTimeZoneIdentifier(_hostTimeZoneString_) is not ~empty~.
32257
-
1. Assert: GetAvailableTimeZoneIdentifier(_hostTimeZoneString_).[[Identifier]] is GetAvailableTimeZoneIdentifier(_hostTimeZoneString_).[[CanonicalIdentifier]].
32257
+
1. Assert: GetAvailableTimeZoneIdentifier(_hostTimeZoneString_).[[Identifier]] is GetAvailableTimeZoneIdentifier(_hostTimeZoneString_).[[PrimaryIdentifier]].
32258
32258
1. Return _hostTimeZoneString_.
32259
32259
</emu-alg>
32260
32260
@@ -32271,7 +32271,7 @@ <h1>HostTimeZoneIdentifier ( ): a String</h1>
32271
32271
<h1>
32272
32272
GetAvailableTimeZoneIdentifier (
32273
32273
_timeZone_: a String value,
32274
-
): either a Record with fields [[Identifier]] (a String value that is a time zone identifier) and [[CanonicalIdentifier]] (a String value that is a canonical time zone identifier), or ~empty~
32274
+
): either a Record with fields [[Identifier]] (a String value that is a time zone identifier) and [[PrimaryIdentifier]] (a String value that is a primary time zone identifier), or ~empty~
32275
32275
</h1>
32276
32276
32277
32277
<dl class="header">
@@ -32288,7 +32288,7 @@ <h1>
32288
32288
</emu-alg>
32289
32289
<emu-note>
32290
32290
Given the same value of _timeZone_ or any value that is an ASCII-case-insensitive match for it, it is recommended that the resulting Record contain the same property values for the lifetime of the surrounding agent.
32291
-
Furthermore, it is recommended that time zone identifiers do not dynamically change from canonical to non-canonical, meaning that if _timeZone_ is a case-insensitive match for the [[CanonicalIdentifier]] property of the result of a previous call to GetAvailableTimeZoneIdentifier, then GetAvailableTimeZoneIdentifier(_timeZone_) will return a record where [[Identifier]] is [[CanonicalIdentifier]].
32291
+
Furthermore, it is recommended that time zone identifiers do not dynamically change from primary to non-primary, meaning that if _timeZone_ is a case-insensitive match for the [[PrimaryIdentifier]] property of the result of a previous call to GetAvailableTimeZoneIdentifier, then GetAvailableTimeZoneIdentifier(_timeZone_) will return a record where [[Identifier]] is [[PrimaryIdentifier]].
32292
32292
Due to the complexity of supporting these requirements, it is recommended that the result of AvailableTimeZoneIdentifiers (and therefore GetAvailableTimeZoneIdentifier) remains the same for the lifetime of the surrounding agent.
0 commit comments