mirror of https://github.com/tc39/test262.git
Make U+2212 MINUS SIGN an invalid sign character for offset time zone IDs
These are the test adjustments corresponding to the normative PR https://github.com/tc39/ecma262/pull/3334 which reached consensus at the June 2024 TC39 meeting.
This commit is contained in:
parent
d2596e2651
commit
7c985a4fd9
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2024 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-createdatetimeformat
|
||||||
|
description: >
|
||||||
|
A valid offset time zone identifier may not include U+2212 MINUS SIGN
|
||||||
|
---*/
|
||||||
|
|
||||||
|
// Note: the first character of each of these strings is U+2122 MINUS SIGN
|
||||||
|
const invalidIDs = [
|
||||||
|
'−0900',
|
||||||
|
'−10:00',
|
||||||
|
'−05',
|
||||||
|
];
|
||||||
|
invalidIDs.forEach((id) => {
|
||||||
|
assert.throws(RangeError, () => new Intl.DateTimeFormat("en", { timeZone: id }));
|
||||||
|
});
|
|
@ -13,9 +13,7 @@ let offsetTimeZones = {
|
||||||
'+13:00': 'Etc/GMT-13',
|
'+13:00': 'Etc/GMT-13',
|
||||||
'-07:00': 'Etc/GMT+7',
|
'-07:00': 'Etc/GMT+7',
|
||||||
'-12': 'Etc/GMT+12',
|
'-12': 'Etc/GMT+12',
|
||||||
'−0900': 'Etc/GMT+9',
|
'-0900': 'Etc/GMT+9',
|
||||||
'−10:00': 'Etc/GMT+10',
|
|
||||||
'−0500': 'Etc/GMT+5',
|
|
||||||
};
|
};
|
||||||
let date = new Date('1995-12-17T03:24:56Z');
|
let date = new Date('1995-12-17T03:24:56Z');
|
||||||
Object.entries(offsetTimeZones).forEach(([offsetZone, gmtZone]) => {
|
Object.entries(offsetTimeZones).forEach(([offsetZone, gmtZone]) => {
|
||||||
|
|
|
@ -13,9 +13,9 @@ let tests = {
|
||||||
'+13:49': {hour: "5", minute: "13"},
|
'+13:49': {hour: "5", minute: "13"},
|
||||||
'-07:56': {hour: "7", minute: "28"},
|
'-07:56': {hour: "7", minute: "28"},
|
||||||
'-12': {hour: "3", minute: "24"},
|
'-12': {hour: "3", minute: "24"},
|
||||||
'−0914': {hour: "6", minute: "10"},
|
'-0914': {hour: "6", minute: "10"},
|
||||||
'−10:03': {hour: "5", minute: "21"},
|
'-10:03': {hour: "5", minute: "21"},
|
||||||
'−0509': {hour: "10", minute: "15"},
|
'-0509': {hour: "10", minute: "15"},
|
||||||
};
|
};
|
||||||
Object.entries(tests).forEach(([timeZone, expected]) => {
|
Object.entries(tests).forEach(([timeZone, expected]) => {
|
||||||
let df = new Intl.DateTimeFormat("en",
|
let df = new Intl.DateTimeFormat("en",
|
||||||
|
|
|
@ -7,7 +7,6 @@ description: Tests that offset time zones are correctly normalized in resolvedOp
|
||||||
let validOffsetTimeZones = {
|
let validOffsetTimeZones = {
|
||||||
'-00': '+00:00',
|
'-00': '+00:00',
|
||||||
'-00:00': '+00:00',
|
'-00:00': '+00:00',
|
||||||
'−00:00': '+00:00',
|
|
||||||
'+00': '+00:00',
|
'+00': '+00:00',
|
||||||
'+0000': '+00:00',
|
'+0000': '+00:00',
|
||||||
'+0300': '+03:00',
|
'+0300': '+03:00',
|
||||||
|
@ -17,14 +16,12 @@ let validOffsetTimeZones = {
|
||||||
'-07:00': '-07:00',
|
'-07:00': '-07:00',
|
||||||
'-14': '-14:00',
|
'-14': '-14:00',
|
||||||
'-2100': '-21:00',
|
'-2100': '-21:00',
|
||||||
'−2200': '-22:00',
|
|
||||||
'+0103': '+01:03',
|
'+0103': '+01:03',
|
||||||
'+15:59': '+15:59',
|
'+15:59': '+15:59',
|
||||||
'+2227': '+22:27',
|
'+2227': '+22:27',
|
||||||
'-02:32': '-02:32',
|
'-02:32': '-02:32',
|
||||||
'-1701': '-17:01',
|
'-1701': '-17:01',
|
||||||
'-22:23': '-22:23',
|
'-22:23': '-22:23',
|
||||||
'−22:53': '-22:53',
|
|
||||||
};
|
};
|
||||||
Object.keys(validOffsetTimeZones).forEach((timeZone) => {
|
Object.keys(validOffsetTimeZones).forEach((timeZone) => {
|
||||||
let df = new Intl.DateTimeFormat(undefined, {timeZone});
|
let df = new Intl.DateTimeFormat(undefined, {timeZone});
|
||||||
|
|
Loading…
Reference in New Issue