Bug 1543641 - Part 3: Remove special-casing for Etc/UCT. r=jwalden a=pascalc
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 12 Apr 2019 13:54:56 +0200
changeset 526453 e3264123c6a279b73e385836ba5013e02e9d5d78
parent 526452 1b1ad8962c6f91350aeaf2303237a7cbbdfbce8a
child 526454 58616119505ce73ee661e5e13ee59dccb8871530
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden, pascalc
bugs1543641
milestone67.0
Bug 1543641 - Part 3: Remove special-casing for Etc/UCT. r=jwalden a=pascalc Etc/UCT resp. UCT is a link to Etc/UTC starting with tzdata 2019a. Differential Revision: https://phabricator.services.mozilla.com//D27344 Depends on D27343
js/src/builtin/intl/DateTimeFormat.js
js/src/tests/non262/Intl/DateTimeFormat/timeZone.js
js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js
--- a/js/src/builtin/intl/DateTimeFormat.js
+++ b/js/src/builtin/intl/DateTimeFormat.js
@@ -216,22 +216,17 @@ function CanonicalizeTimeZoneName(timeZo
 
     // Step 2.
     var ianaTimeZone = intl_canonicalizeTimeZone(timeZone);
     assert(ianaTimeZone !== "Etc/Unknown", "Invalid canonical time zone");
     assert(ianaTimeZone === intl_IsValidTimeZoneName(ianaTimeZone), "Unsupported canonical time zone");
 
     // Step 3.
     if (ianaTimeZone === "Etc/UTC" || ianaTimeZone === "Etc/GMT") {
-        // ICU/CLDR canonicalizes Etc/UCT to Etc/GMT, but following IANA and
-        // ECMA-402 to the letter means Etc/UCT is a separate time zone.
-        if (timeZone === "Etc/UCT" || timeZone === "UCT")
-            ianaTimeZone = "Etc/UCT";
-        else
-            ianaTimeZone = "UTC";
+        ianaTimeZone = "UTC";
     }
 
     // Step 4.
     return ianaTimeZone;
 }
 
 var timeZoneCache = {
     icuDefaultTimeZone: undefined,
--- a/js/src/tests/non262/Intl/DateTimeFormat/timeZone.js
+++ b/js/src/tests/non262/Intl/DateTimeFormat/timeZone.js
@@ -16,40 +16,27 @@ const utcTimeZones = [
 
     // Links to Etc/UTC. (tzdata/etcetera)
     "Etc/Universal", "Etc/Zulu",
 
     // Links to Etc/GMT. (tzdata/backward)
     "GMT+0", "GMT-0", "GMT0", "Greenwich",
 
     // Links to Etc/UTC. (tzdata/backward)
-    "UTC", "Universal", "Zulu",
+    "UTC", "Universal", "Zulu", "Etc/UCT", "UCT",
 ];
 
 for (let timeZone of utcTimeZones) {
     for (let map of tzMapper) {
         let dtf = new Intl.DateTimeFormat(undefined, {timeZone: map(timeZone)});
         assertEq(dtf.resolvedOptions().timeZone, "UTC");
     }
 }
 
 
-// ECMA-402 doesn't normalize Etc/UCT to UTC.
-const uctTimeZones = [
-    "Etc/UCT", "UCT",
-];
-
-for (let timeZone of uctTimeZones) {
-    for (let map of tzMapper) {
-        let dtf = new Intl.DateTimeFormat(undefined, {timeZone: map(timeZone)});
-        assertEq(dtf.resolvedOptions().timeZone, "Etc/UCT");
-    }
-}
-
-
 const invalidTimeZones = [
     "", "null", "undefined", "UTC\0",
 
     // ICU time zone name for invalid time zones.
     "Etc/Unknown",
 
     // ICU custom time zones.
     "GMT-1", "GMT+1", "GMT-10", "GMT+10",
--- a/js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js
+++ b/js/src/tests/non262/Intl/DateTimeFormat/tz-environment-variable.js
@@ -46,17 +46,17 @@ const timeZones = [
     { id: "PST8PDT" },
     // ICU on non-Windows platforms doesn't accept these three time zone
     // identifiers, cf. isValidOlsonID in $ICU/source/common/putil.cpp. We
     // could add support for them, but it seems unlikely they're used in
     // practice, so we just skip over them.
     // { id: "GMT+0", normalized: "UTC" },
     // { id: "GMT-0", normalized: "UTC" },
     // { id: "GMT0", normalized: "UTC" },
-    { id: "UCT", normalized: "Etc/UCT" },
+    { id: "UCT", normalized: "UTC" },
     { id: "UTC", normalized: "UTC" },
     { id: "GMT", normalized: "UTC" },
 ];
 
 for (let {id, normalized = id} of timeZones) {
     inTimeZone(id, () => {
         let opts = new Intl.DateTimeFormat().resolvedOptions();
         assertEq(opts.timeZone, normalized);