Debian Codegraph @

js/src/tests/test262/intl402/Temporal/ZonedDateTime/legacy-non-iana.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 André Bargull. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.zoneddatetime
7 description: Only IANA time zone identifiers are allowed.
8 features: [Temporal]
9 ---*/
10
11 // List of non-IANA link names, copied from:
12 // https://github.com/unicode-org/icu/blob/main/icu4c/source/tools/tzcode/icuzones
13 const invalidTimeZones = [
14 "ACT",
15 "AET",
16 "AGT",
17 "ART",
18 "AST",
19 "BET",
20 "BST",
21 "CAT",
22 "CNT",
23 "CST",
24 "CTT",
25 "EAT",
26 "ECT",
27 "IET",
28 "IST",
29 "JST",
30 "MIT",
31 "NET",
32 "NST",
33 "PLT",
34 "PNT",
35 "PRT",
36 "PST",
37 "SST",
38 "VST",
39 ];
40
41 for (let timeZone of invalidTimeZones) {
42 assert.throws(RangeError, () => {
43 new Temporal.ZonedDateTime(0n, timeZone);
44 }, "Time zone: " + timeZone);
45 }
46
47 reportCompare(0, 0);