From 6ac7d5fdb08d1cff7720d72ae6ddf0a510ef27ed Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Sat, 1 Jul 2023 13:29:59 -0700 Subject: [PATCH] Normative: fix SystemTimeZoneIdentifier offsets This commit adds a "normalized format of a time zone identifier" definition, and uses it to ensure that SystemTimeZoneIdentifier only returns normalized identifiers like "-05:00" (not "-0500" nor "-05") or "America/Los_Angeles" (not "AMERICA/LOS_ANGELES" nor "AmErIcA/lOs_AnGeLeS"). No current implementations return offset strings in non-normalized format, so although this is a normative change, it won't break existing ECMAScript code nor will it require changes to current implementations. Fixes #2584. --- spec/abstractops.html | 3 +++ spec/mainadditions.html | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/abstractops.html b/spec/abstractops.html index 14b2e30dc9..b08121d8da 100644 --- a/spec/abstractops.html +++ b/spec/abstractops.html @@ -1101,6 +1101,9 @@

ISO 8601 grammar

UTCOffsetWithSubMinuteComponents[Extended] : Sign Hour[+Padded] TimeSeparator[?Extended] MinuteSecond TimeSeparator[?Extended] MinuteSecond Fraction? + NormalizedUTCOffset : + ASCIISign Hour[+Padded] `:` MinuteSecond + UTCOffsetMinutePrecision : Sign Hour[+Padded] Sign Hour[+Padded] TimeSeparator[+Extended] MinuteSecond diff --git a/spec/mainadditions.html b/spec/mainadditions.html index aad41f202f..3452d20ce4 100644 --- a/spec/mainadditions.html +++ b/spec/mainadditions.html @@ -219,7 +219,6 @@

Time Zone Identifiers

Time zones in ECMAScript are represented by time zone identifiers, which are Strings composed entirely of code units in the inclusive interval from 0x0000 to 0x007F0x0021 to 0x007E. Time zones supported by an ECMAScript implementation may be available named time zones, represented by the [[Identifier]] field of the Time Zone Identifier Records returned by AvailableNamedTimeZoneIdentifiers, or offset time zones, represented by Strings for which IsTimeZoneOffsetStringIsOffsetTimeZoneIdentifier returns *true*. - Time zone identifiers are compared using ASCII-case-insensitive comparisons.

A primary time zone identifier is the preferred identifier for an available named time zone. @@ -228,6 +227,15 @@

Time Zone Identifiers

Each available named time zone identifier is associated with exactly one available named time zone. Each available named time zone is associated with exactly one primary time zone identifier and zero or more non-primary time zone identifiers.

+ +

+ Time zone identifiers are compared using ASCII-case-insensitive comparisons, and are accepted as input in any variation of letter case. + Offset time zone identifiers are compared using the number of minutes represented (not as a String), and are accepted as input in any the formats specified by |TimeZoneUTCOffsetName|. + However, ECMAScript built-in objects will only output the normalized format of a time zone identifier. + The normalized format of an available named time zone identifier is the preferred letter case for that identifier. + The normalized format of an offset time zone identifier is specified by |NormalizedUTCOffset|. +

+

ECMAScript implementations must support an available named time zone with the identifier *"UTC"*, which must be the primary time zone identifier for the UTC time zone. In addition, implementations may support any number of other available named time zones. @@ -283,7 +291,7 @@

SystemTimeZoneIdentifier ( ): a String

1. If the implementation only supports the UTC time zone, return *"UTC"*. - 1. Let _systemTimeZoneString_ be the String representing the host environment's current time zone, either: a primary time zone identifier; or an offset time zone identifier. + 1. Let _systemTimeZoneString_ be the String representing the host environment's current time zone, either a primary time zone identifier or an offset time zone identifier, as a time zone identifier in normalized format. 1. Return _systemTimeZoneString_.