From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- .../DateTimeFormat/timezone-legacy-non-iana.js | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 js/src/tests/test262/intl402/DateTimeFormat/timezone-legacy-non-iana.js (limited to 'js/src/tests/test262/intl402/DateTimeFormat/timezone-legacy-non-iana.js') diff --git a/js/src/tests/test262/intl402/DateTimeFormat/timezone-legacy-non-iana.js b/js/src/tests/test262/intl402/DateTimeFormat/timezone-legacy-non-iana.js new file mode 100644 index 0000000000..d99cf18df4 --- /dev/null +++ b/js/src/tests/test262/intl402/DateTimeFormat/timezone-legacy-non-iana.js @@ -0,0 +1,45 @@ +// 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); +} + +reportCompare(0, 0); -- cgit v1.2.3