diff --git a/test/intl402/DateTimeFormat/timezone-legacy-non-iana.js b/test/intl402/DateTimeFormat/timezone-legacy-non-iana.js new file mode 100644 index 0000000000..e0adeca999 --- /dev/null +++ b/test/intl402/DateTimeFormat/timezone-legacy-non-iana.js @@ -0,0 +1,43 @@ +// Copyright (C) 2024 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-initializedatetimeformat +description: Only IANA time zone identifiers are allowed. +---*/ + +// List of non-IANA link names, copied from: +// https://github.com/unicode-org/icu/blob/main/icu4c/source/tools/tzcode/icuzones +const invalidTimeZones = [ + "ACT", + "AET", + "AGT", + "ART", + "AST", + "BET", + "BST", + "CAT", + "CNT", + "CST", + "CTT", + "EAT", + "ECT", + "IET", + "IST", + "JST", + "MIT", + "NET", + "NST", + "PLT", + "PNT", + "PRT", + "PST", + "SST", + "VST", +]; + +for (let timeZone of invalidTimeZones) { + assert.throws(RangeError, () => { + new Intl.DateTimeFormat(undefined, {timeZone}); + }, "Time zone: " + timeZone); +} diff --git a/test/intl402/Temporal/TimeZone/from/timezone-string-legacy-non-iana.js b/test/intl402/Temporal/TimeZone/from/timezone-string-legacy-non-iana.js new file mode 100644 index 0000000000..88008dc53d --- /dev/null +++ b/test/intl402/Temporal/TimeZone/from/timezone-string-legacy-non-iana.js @@ -0,0 +1,44 @@ +// Copyright (C) 2024 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.from +description: Only IANA time zone identifiers are allowed. +features: [Temporal] +---*/ + +// List of non-IANA link names, copied from: +// https://github.com/unicode-org/icu/blob/main/icu4c/source/tools/tzcode/icuzones +const invalidTimeZones = [ + "ACT", + "AET", + "AGT", + "ART", + "AST", + "BET", + "BST", + "CAT", + "CNT", + "CST", + "CTT", + "EAT", + "ECT", + "IET", + "IST", + "JST", + "MIT", + "NET", + "NST", + "PLT", + "PNT", + "PRT", + "PST", + "SST", + "VST", +]; + +for (let timeZone of invalidTimeZones) { + assert.throws(RangeError, () => { + Temporal.TimeZone.from(timeZone); + }, "Time zone: " + timeZone); +} diff --git a/test/intl402/Temporal/TimeZone/legacy-non-iana.js b/test/intl402/Temporal/TimeZone/legacy-non-iana.js new file mode 100644 index 0000000000..87db5d09f4 --- /dev/null +++ b/test/intl402/Temporal/TimeZone/legacy-non-iana.js @@ -0,0 +1,44 @@ +// Copyright (C) 2024 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone +description: Only IANA time zone identifiers are allowed. +features: [Temporal] +---*/ + +// List of non-IANA link names, copied from: +// https://github.com/unicode-org/icu/blob/main/icu4c/source/tools/tzcode/icuzones +const invalidTimeZones = [ + "ACT", + "AET", + "AGT", + "ART", + "AST", + "BET", + "BST", + "CAT", + "CNT", + "CST", + "CTT", + "EAT", + "ECT", + "IET", + "IST", + "JST", + "MIT", + "NET", + "NST", + "PLT", + "PNT", + "PRT", + "PST", + "SST", + "VST", +]; + +for (let timeZone of invalidTimeZones) { + assert.throws(RangeError, () => { + new Temporal.TimeZone(timeZone); + }, "Time zone: " + timeZone); +}