summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js')
-rw-r--r--js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js b/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js
new file mode 100644
index 0000000000..b2be51b737
--- /dev/null
+++ b/js/src/tests/test262/intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2021 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.supportedvaluesof
+description: >
+ The returned "timeZone" values can be used with DateTimeFormat.
+info: |
+ Intl.supportedValuesOf ( key )
+
+ 1. Let key be ? ToString(key).
+ ...
+ 6. Else if key is "timeZone", then
+ a. Let list be ! AvailableTimeZones( ).
+ ...
+ 9. Return ! CreateArrayFromList( list ).
+
+ AvailableTimeZones ()
+ The AvailableTimeZones abstract operation returns a sorted List of supported
+ Zone and Link names in the IANA Time Zone Database. The following steps are
+ taken:
+
+ 1. Let names be a List of all supported Zone and Link names in the IANA Time
+ Zone Database.
+ 2. Let result be a new empty List.
+ 3. For each element name of names, do
+ a. Assert: ! IsValidTimeZoneName( name ) is true.
+ b. Let canonical be ! CanonicalizeTimeZoneName( name ).
+ c. If result does not contain an element equal to canonical, then
+ i. Append canonical to the end of result.
+ 4. Sort result in order as if an Array of the same values had been sorted using
+ %Array.prototype.sort% using undefined as comparefn.
+ 5. Return result.
+locale: [en]
+features: [Intl-enumeration]
+---*/
+
+const timeZones = Intl.supportedValuesOf("timeZone");
+
+for (let timeZone of timeZones) {
+ let obj = new Intl.DateTimeFormat("en", {timeZone});
+ assert.sameValue(obj.resolvedOptions().timeZone, timeZone,
+ `${timeZone} is supported by DateTimeFormat`);
+}
+
+reportCompare(0, 0);