From 6e81071eaf49e3a4c47eb0bd8c84fd57e3fc128a Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Fri, 28 Jun 2024 02:06:18 +0300 Subject: [PATCH] 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. --- .../offset-timezone-no-unicode-minus-sign.js | 17 +++++++++++++++++ .../format/offset-timezone-gmt-same.js | 4 +--- .../formatToParts/offset-timezone-correct.js | 6 +++--- .../resolvedOptions/offset-timezone-change.js | 3 --- 4 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 test/intl402/DateTimeFormat/offset-timezone-no-unicode-minus-sign.js diff --git a/test/intl402/DateTimeFormat/offset-timezone-no-unicode-minus-sign.js b/test/intl402/DateTimeFormat/offset-timezone-no-unicode-minus-sign.js new file mode 100644 index 00000000000..280a5c282f8 --- /dev/null +++ b/test/intl402/DateTimeFormat/offset-timezone-no-unicode-minus-sign.js @@ -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 })); +}); diff --git a/test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js b/test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js index 3da20261cd8..f8be5cd8349 100644 --- a/test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js +++ b/test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js @@ -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]) => { diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js b/test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js index 1ae0a184b7b..701e1dad0af 100644 --- a/test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js @@ -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", diff --git a/test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js b/test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js index 0a11da98f70..2e10965199b 100644 --- a/test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js +++ b/test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js @@ -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', @@ -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});