Skip to content

Commit

Permalink
Make U+2212 MINUS SIGN an invalid sign character for offset time zone…
Browse files Browse the repository at this point in the history
… IDs

These are the test adjustments corresponding to the normative PR
tc39/ecma262#3334 which reached consensus at the
June 2024 TC39 meeting.
  • Loading branch information
ptomato committed Jun 27, 2024
1 parent 27b2551 commit 6e81071
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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 }));
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ let offsetTimeZones = {
'+13:00': 'Etc/GMT-13',
'-07:00': 'Etc/GMT+7',
'-12': 'Etc/GMT+12',
'−0900': 'Etc/GMT+9',
'−10:00': 'Etc/GMT+10',
'−0500': 'Etc/GMT+5',
'-0900': 'Etc/GMT+9',
};
let date = new Date('1995-12-17T03:24:56Z');
Object.entries(offsetTimeZones).forEach(([offsetZone, gmtZone]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ let tests = {
'+13:49': {hour: "5", minute: "13"},
'-07:56': {hour: "7", minute: "28"},
'-12': {hour: "3", minute: "24"},
'0914': {hour: "6", minute: "10"},
'10:03': {hour: "5", minute: "21"},
'0509': {hour: "10", minute: "15"},
'-0914': {hour: "6", minute: "10"},
'-10:03': {hour: "5", minute: "21"},
'-0509': {hour: "10", minute: "15"},
};
Object.entries(tests).forEach(([timeZone, expected]) => {
let df = new Intl.DateTimeFormat("en",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ description: Tests that offset time zones are correctly normalized in resolvedOp
let validOffsetTimeZones = {
'-00': '+00:00',
'-00:00': '+00:00',
'−00:00': '+00:00',
'+00': '+00:00',
'+0000': '+00:00',
'+0300': '+03:00',
Expand All @@ -17,14 +16,12 @@ let validOffsetTimeZones = {
'-07:00': '-07:00',
'-14': '-14:00',
'-2100': '-21:00',
'−2200': '-22:00',
'+0103': '+01:03',
'+15:59': '+15:59',
'+2227': '+22:27',
'-02:32': '-02:32',
'-1701': '-17:01',
'-22:23': '-22:23',
'−22:53': '-22:53',
};
Object.keys(validOffsetTimeZones).forEach((timeZone) => {
let df = new Intl.DateTimeFormat(undefined, {timeZone});
Expand Down

0 comments on commit 6e81071

Please sign in to comment.