Skip to content

Commit

Permalink
Bug 1930466 - Part 1: Use zone.tab to guide time zone canonicalisatio…
Browse files Browse the repository at this point in the history
…n. r=dminor

Implement the changes from <tc39/ecma402#877> to reduce
differences in time zone canonicalisation when compared to V8 and JSC (which
both use CLDR time zone data instead of IANA time zone data).

Implementing the `AvailableNamedTimeZoneIdentifiers` spec operation requires to
link time zone identifiers to region codes. When the time zone is listed in the
"zone.tab" file, we can get the region code from "zone.tab". In all other cases
we need to manually map the time zone to a matching region, because CLDR doesn't
have "public" data for this [1]. This is implemented using the new file
"intl/TimeZoneMapping.yaml".

ICU 74 added `ucal_getIanaTimeZoneID` to get the canonical IANA time zone id.
Internally `ucal_getIanaTimeZoneID` first calls `ucal_getCanonicalTimeZoneID`
and then loads a resource bundle to check if there are any time zone ids which
need to be replaced with other ids for compatibility with IANA data. Unfortunately
the resource bundle is not cached, so calling `ucal_getIanaTimeZoneID` instead
of `ucal_getIanaTimeZoneID` adds a considerable performance overhead. To avoid
any performance regressions, we keep our own time zone rewriting code for the
time being.

Using our own code also means we don't have to add a workaround for this CLDR
bug: <https://unicode-org.atlassian.net/browse/CLDR-16439>.

Also remove "Factory" from the list of supported time zone identifiers, because
supporting it was always a bit questionable and latest V8 also doesn't support
it anymore, so we shouldn't run into web-compat issues.

Remove the old generated tests and add "timeZone_links.js" to ensure time zone
links are correctly resolved.

[1] Neither of these two files look like "public" data to me:
- https://github.com/unicode-org/cldr/blob/main/tools/cldr-code/src/main/resources/org/unicode/cldr/util/data/TZID.txt
- https://github.com/unicode-org/cldr/blob/main/tools/cldr-code/src/main/resources/org/unicode/cldr/icu/idList.txt

Differential Revision: https://phabricator.services.mozilla.com/D228584

UltraBlame original commit: 880f2288640c43653f56bc919e9d16434426bf84
  • Loading branch information
marco-c committed Dec 1, 2024
1 parent 4009727 commit 8aeb28f
Show file tree
Hide file tree
Showing 11 changed files with 2,709 additions and 4,292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ getJSTestingFunctions
setTimeZone
(
"
PST8PDT
America
/
Los_Angeles
"
)
;
Expand All @@ -53,7 +55,9 @@ resolvedOptions
.
timeZone
"
PST8PDT
America
/
Los_Angeles
"
"
Default
Expand Down Expand Up @@ -721,7 +725,9 @@ getJSTestingFunctions
setTimeZone
(
"
PST8PDT
America
/
Los_Angeles
"
)
;
Expand All @@ -744,7 +750,9 @@ resolvedOptions
.
timeZone
"
PST8PDT
America
/
Los_Angeles
"
"
Default
Expand Down Expand Up @@ -820,7 +828,9 @@ resolvedOptions
.
timeZone
"
PST8PDT
America
/
Los_Angeles
"
"
Content
Expand Down Expand Up @@ -1027,7 +1037,9 @@ getJSTestingFunctions
setTimeZone
(
"
PST8PDT
America
/
Los_Angeles
"
)
;
Expand All @@ -1050,7 +1062,9 @@ resolvedOptions
.
timeZone
"
PST8PDT
America
/
Los_Angeles
"
"
Default
Expand Down Expand Up @@ -1102,7 +1116,9 @@ resolvedOptions
.
timeZone
"
PST8PDT
America
/
Los_Angeles
"
"
Timezone
Expand Down Expand Up @@ -1163,7 +1179,9 @@ resolvedOptions
.
timeZone
"
PST8PDT
America
/
Los_Angeles
"
"
Timezone
Expand Down
Loading

0 comments on commit 8aeb28f

Please sign in to comment.