diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js b/js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js new file mode 100644 index 0000000000..56c9fc262c --- /dev/null +++ b/js/src/tests/non262/Date/reset-time-zone-cache-same-offset.js @@ -0,0 +1,30 @@ +// |reftest| skip-if(xulRuntime.OS=="WINNT") -- Windows doesn't accept IANA names for the TZ env variable + +const testCases = [ + { + timeZone: "Europe/London", + string: "Tue Aug 14 2018 00:00:00 GMT+0100 (BST)", + alternativeTimeZones: ["British Summer Time"], + localeString: "8/14/2018, 12:00:00 AM GMT+1", + }, + { + timeZone: "UTC", + string: "Tue Aug 14 2018 00:00:00 GMT+0000 (UTC)", + alternativeTimeZones: ["Coordinated Universal Time"], + localeString: "8/14/2018, 12:00:00 AM UTC", + }, +]; + +// Repeat twice to test both transitions (Europe/London -> UTC and UTC -> Europe/London). +for (let i = 0; i < 2; ++i) { + for (let {timeZone, string, localeString, alternativeTimeZones} of testCases) { + setTimeZone(timeZone); + + let dt = new Date(2018, 8 - 1, 14); + assertDateTime(dt, string, ...alternativeTimeZones); + assertEq(dt.toLocaleString("en-US", {timeZoneName: "short"}), localeString); + } +} + +if (typeof reportCompare === "function") + reportCompare(true, true); |