From bb8349792dbaa167fee3f242a1c1c8602a577c40 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 4 Nov 2025 15:04:28 -0800 Subject: [PATCH 1/7] Temporal: Add test for formatting Temporal objects with era formatter See https://github.com/tc39/proposal-temporal/issues/3049 --- .../temporal-objects-format-with-era.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js diff --git a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js new file mode 100644 index 00000000000..4525d09be3b --- /dev/null +++ b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js @@ -0,0 +1,19 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-datetime-format-functions +description: > + If era option and no other options are provided to DateTimeFormat constructor, + objects should be formatted with default options +features: [Temporal] +---*/ + +const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); + +assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); +assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); +assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); +assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("A"), "formatting a PlainTime should work"); +assert(formatter.format(new Temporal.PlainDateTime(2025, 11, 4, 14, 46)).startsWith("11"), "formatting a PlainDateTime should work"); +assert(formatter.format(new Temporal.Instant(0n)).startsWith("12"), "formatting an Instant should work"); From cf569dedc62e9585221dda00bb1852c9a05a0b61 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 7 Nov 2025 12:44:13 -0800 Subject: [PATCH 2/7] Be consistent with spec about not including era when formatting a PlainTime --- .../prototype/format/temporal-objects-format-with-era.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js index 4525d09be3b..bcea2b9a2ff 100644 --- a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js @@ -14,6 +14,6 @@ const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); -assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("A"), "formatting a PlainTime should work"); +assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("2"), "formatting a PlainTime should work"); assert(formatter.format(new Temporal.PlainDateTime(2025, 11, 4, 14, 46)).startsWith("11"), "formatting a PlainDateTime should work"); assert(formatter.format(new Temporal.Instant(0n)).startsWith("12"), "formatting an Instant should work"); From 561c6713d5c1c89799f808fd9a5b9bbeb7c9fd6c Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 7 Nov 2025 12:44:18 -0800 Subject: [PATCH 3/7] Add more tests --- .../Instant/prototype/toLocaleString/era.js | 14 ++++++++++ .../PlainDate/prototype/toLocaleString/era.js | 14 ++++++++++ .../prototype/toLocaleString/era.js | 14 ++++++++++ .../prototype/toLocaleString/era.js | 14 ++++++++++ .../PlainTime/prototype/toLocaleString/era.js | 17 +++++++++++ .../prototype/toLocaleString/era.js | 14 ++++++++++ .../prototype/toLocaleString/era.js | 14 ++++++++++ .../temporal-objects-format-with-era.js | 19 +++++++++++++ .../temporal-objects-format-with-era.js | 28 +++++++++++++++++++ .../temporal-objects-format-with-era.js | 27 ++++++++++++++++++ 10 files changed, 175 insertions(+) create mode 100644 test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js create mode 100644 test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js create mode 100644 test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js create mode 100644 test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js create mode 100644 test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js create mode 100644 test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js create mode 100644 test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js create mode 100644 test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js create mode 100644 test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js create mode 100644 test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js diff --git a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js new file mode 100644 index 00000000000..90cf1eb651e --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L.. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.instant.prototype.tolocalestring +description: > + If era option and no other options are provided to toLocaleString, + Instant should be foramtted with default options +features: [Temporal] +---*/ + +const instant = new Temporal.Instant(0n); + +assert(instant.toLocaleString("en", { era: "narrow" }).startsWith("1"), "toLocaleString on an Instant with era option should work"); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js new file mode 100644 index 00000000000..9e0cfd5f311 --- /dev/null +++ b/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L.. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindate.prototype.tolocalestring +description: > + If era option and no other options are provided to toLocaleString, + PlainDate should be foramtted with default options +features: [Temporal] +---*/ + +const date = new Temporal.PlainDate(2000, 5, 2, "gregory"); + +assert(date.toLocaleString("en", { era: "narrow" }).startsWith("5"), "toLocaleString on a PlainDate with era option should work"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js new file mode 100644 index 00000000000..60793f496c5 --- /dev/null +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L.. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaindatetime.prototype.tolocalestring +description: > + If era option and no other options are provided to toLocaleString, + PlainDateTime should be foramtted with default options +features: [Temporal] +---*/ + +date = new Temporal.PlainDateTime(2000, 5, 2, 14, 46, 0, 0, 0, 0, "gregory"); + +assert(date.toLocaleString("en", { era: "narrow" }).startsWith("5"), "toLocaleString on a PlainDateTime with era option should work"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js new file mode 100644 index 00000000000..468339a115b --- /dev/null +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L.. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainmonthday.prototype.tolocalestring +description: > + If era option and no other options are provided to toLocaleString, + PlainMonthDay should be foramtted with default options +features: [Temporal] +---*/ + +const date = new Temporal.PlainMonthDay(5, 2, "gregory"); + +assert(date.toLocaleString("en", { era: "narrow" }).startsWith("5"), "toLocaleString on a PlainMonthDay with era option should work"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js new file mode 100644 index 00000000000..ca0c78fd522 --- /dev/null +++ b/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js @@ -0,0 +1,17 @@ +// Copyright (C) 2025 Igalia, S.L.. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.tolocalestring +description: > + If era option and no other options are provided to toLocaleString, + PlainTime should be foramtted with default options +features: [Temporal] +---*/ + +const date = new Temporal.PlainTime(14, 46); + +const result = date.toLocaleString("en", { era: "narrow" }); + +assert(result.startsWith("2"), "toLocaleString on a PlainTime with era option should work"); +assert(!result.includes("A"), "era should be ignored when formatting a PlainTime"); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js new file mode 100644 index 00000000000..446f6e5a527 --- /dev/null +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L.. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plainyearmonth.prototype.tolocalestring +description: > + If era option and no other options are provided to toLocaleString, + PlainYearMonth should be foramtted with default options +features: [Temporal] +---*/ + +const date = new Temporal.PlainYearMonth(2000, 5, "gregory"); + +assert(date.toLocaleString("en", { era: "narrow" }).startsWith("5"), "toLocaleString on a PlainYearMonth with era option should work"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js new file mode 100644 index 00000000000..f91fabd0806 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js @@ -0,0 +1,14 @@ +// Copyright (C) 2025 Igalia, S.L.. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.tolocalestring +description: > + If era option and no other options are provided to toLocaleString, + ZonedDateTime should be foramtted with default options +features: [Temporal] +---*/ + +const zdt = new Temporal.ZonedDateTime(0n, "UTC"); + +assert(zdt.toLocaleString("en", { era: "narrow" }).startsWith("1"), "toLocaleString on a ZonedDateTime with era option should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js new file mode 100644 index 00000000000..e6b05007d60 --- /dev/null +++ b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js @@ -0,0 +1,19 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-datetime-format-functions +description: > + If era option and no other options are provided to DateTimeFormat constructor, + objects should be formatted with default options +features: [Temporal] +---*/ + +const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); + +assert(formatter.formatRange(new Temporal.PlainDate(2025, 11, 4), new Temporal.PlainDate(2025, 11, 5)).startsWith("11"), "formatting a PlainDate should work"); +assert(formatter.formatRange(new Temporal.PlainYearMonth(2025, 11, "gregory"), new Temporal.PlainYearMonth(2025, 12, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); +assert(formatter.formatRange(new Temporal.PlainMonthDay(11, 4, "gregory"), new Temporal.PlainMonthDay(11, 14, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); +assert(formatter.formatRange(new Temporal.PlainTime(14, 46), new Temporal.PlainTime(17, 46)).startsWith("2"), "formatting a PlainTime should work"); +assert(formatter.formatRange(new Temporal.PlainDateTime(2025, 11, 4, 14, 46), new Temporal.PlainDateTime(2025, 11, 15, 14, 47)).startsWith("11"), "formatting a PlainDateTime should work"); +assert(formatter.formatRange(new Temporal.Instant(0n), new Temporal.Instant(1000000000n)).startsWith("12"), "formatting an Instant should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js new file mode 100644 index 00000000000..b66427494f9 --- /dev/null +++ b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js @@ -0,0 +1,28 @@ +// Copyright (C) 2024 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-datetime-format-functions +description: > + If era option and no other options are provided to DateTimeFormat constructor, + objects should be formatted with default options +features: [Temporal] +---*/ + +const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); + +function checkEra(parts) { + for (let part of parts) { + if (part.type === 'era' && part.value.startsWith('A')) + return true; + } + return false; +} + +assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDate(2025, 11, 4), new Temporal.PlainDate(2025, 11, 5))), "formatting a PlainDate should work"); +assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDate(2025, 11, 4), new Temporal.PlainDate(2025, 11, 5))), "formatting a PlainDate should work"); +assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainYearMonth(2025, 11, "gregory"), new Temporal.PlainYearMonth(2025, 12, "gregory"))), "formatting a PlainYearMonth should work"); +assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainMonthDay(11, 4, "gregory"), new Temporal.PlainMonthDay(11, 14, "gregory"))), "formatting a PlainMonthDay should work"); +assert(!checkEra(formatter.formatRangeToParts(new Temporal.PlainTime(14, 46), new Temporal.PlainTime(17, 46))), "formatting a PlainTime should work"); +assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDateTime(2025, 11, 4, 14, 46), new Temporal.PlainDateTime(2025, 11, 15, 14, 47))), "formatting a PlainDateTime should work"); +assert(checkEra(formatter.formatRangeToParts(new Temporal.Instant(0n), new Temporal.Instant(1000000000n))), "formatting an Instant should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js new file mode 100644 index 00000000000..9bbd79ad87c --- /dev/null +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js @@ -0,0 +1,27 @@ +// Copyright (C) 2025 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-datetime-format-functions +description: > + If era option and no other options are provided to DateTimeFormat constructor, + objects should be formatted with default options +features: [Temporal] +---*/ + +const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); + +function checkEra(parts) { + for (let part of parts) { + if (part.type === 'era' && part.value.startsWith('A')) + return true; + } + return false; +} + +assert(checkEra(formatter.formatToParts(new Temporal.PlainDate(2025, 11, 4))), "formatting a PlainDate should work"); +assert(checkEra(formatter.formatToParts(new Temporal.PlainYearMonth(2025, 11, "gregory"))), "formatting a PlainYearMonth should work"); +assert(checkEra(formatter.formatToParts(new Temporal.PlainMonthDay(11, 4, "gregory"))), "formatting a PlainMonthDay should work"); +assert(!checkEra(formatter.formatToParts(new Temporal.PlainTime(14, 46))), "formatting a PlainTime should work"); +assert(checkEra(formatter.formatToParts(new Temporal.PlainDateTime(2025, 11, 4, 14, 46))), "formatting a PlainDateTime should work"); +assert(checkEra(formatter.formatToParts(new Temporal.Instant(0n))), "formatting an Instant should work"); From 8ae6c6275539d863398cc89d86fc478ea78db52b Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 7 Nov 2025 12:57:49 -0800 Subject: [PATCH 4/7] Fix locales --- .../Instant/prototype/toLocaleString/era.js | 1 + .../PlainDate/prototype/toLocaleString/era.js | 1 + .../PlainDateTime/prototype/toLocaleString/era.js | 1 + .../PlainMonthDay/prototype/toLocaleString/era.js | 1 + .../PlainTime/prototype/toLocaleString/era.js | 1 + .../prototype/toLocaleString/era.js | 1 + .../ZonedDateTime/prototype/toLocaleString/era.js | 1 + .../format/temporal-objects-format-with-era.js | 3 ++- .../temporal-objects-format-with-era.js | 15 ++++++++------- .../temporal-objects-format-with-era.js | 3 ++- .../temporal-objects-format-with-era.js | 3 ++- 11 files changed, 21 insertions(+), 10 deletions(-) diff --git a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js index 90cf1eb651e..2a2c394a832 100644 --- a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js @@ -7,6 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, Instant should be foramtted with default options features: [Temporal] +locales: [en] ---*/ const instant = new Temporal.Instant(0n); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js index 9e0cfd5f311..3719bdcf559 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js @@ -7,6 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainDate should be foramtted with default options features: [Temporal] +locales: [en] ---*/ const date = new Temporal.PlainDate(2000, 5, 2, "gregory"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js index 60793f496c5..b2c986e00b3 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js @@ -7,6 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainDateTime should be foramtted with default options features: [Temporal] +locales: [en] ---*/ date = new Temporal.PlainDateTime(2000, 5, 2, 14, 46, 0, 0, 0, 0, "gregory"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js index 468339a115b..7c00c8d893c 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js @@ -7,6 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainMonthDay should be foramtted with default options features: [Temporal] +locales: [en] ---*/ const date = new Temporal.PlainMonthDay(5, 2, "gregory"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js index ca0c78fd522..52a547d595d 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js @@ -7,6 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainTime should be foramtted with default options features: [Temporal] +locales: [en] ---*/ const date = new Temporal.PlainTime(14, 46); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js index 446f6e5a527..d19d28ce73a 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js @@ -7,6 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainYearMonth should be foramtted with default options features: [Temporal] +locales: [en] ---*/ const date = new Temporal.PlainYearMonth(2000, 5, "gregory"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js index f91fabd0806..cc41ffc8954 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js @@ -7,6 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, ZonedDateTime should be foramtted with default options features: [Temporal] +locales: [en] ---*/ const zdt = new Temporal.ZonedDateTime(0n, "UTC"); diff --git a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js index bcea2b9a2ff..03d0d91228a 100644 --- a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js @@ -7,9 +7,10 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] +locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js index e6b05007d60..03d0d91228a 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js @@ -7,13 +7,14 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] +locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); -assert(formatter.formatRange(new Temporal.PlainDate(2025, 11, 4), new Temporal.PlainDate(2025, 11, 5)).startsWith("11"), "formatting a PlainDate should work"); -assert(formatter.formatRange(new Temporal.PlainYearMonth(2025, 11, "gregory"), new Temporal.PlainYearMonth(2025, 12, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); -assert(formatter.formatRange(new Temporal.PlainMonthDay(11, 4, "gregory"), new Temporal.PlainMonthDay(11, 14, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); -assert(formatter.formatRange(new Temporal.PlainTime(14, 46), new Temporal.PlainTime(17, 46)).startsWith("2"), "formatting a PlainTime should work"); -assert(formatter.formatRange(new Temporal.PlainDateTime(2025, 11, 4, 14, 46), new Temporal.PlainDateTime(2025, 11, 15, 14, 47)).startsWith("11"), "formatting a PlainDateTime should work"); -assert(formatter.formatRange(new Temporal.Instant(0n), new Temporal.Instant(1000000000n)).startsWith("12"), "formatting an Instant should work"); +assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); +assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); +assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); +assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("2"), "formatting a PlainTime should work"); +assert(formatter.format(new Temporal.PlainDateTime(2025, 11, 4, 14, 46)).startsWith("11"), "formatting a PlainDateTime should work"); +assert(formatter.format(new Temporal.Instant(0n)).startsWith("12"), "formatting an Instant should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js index b66427494f9..a8758568811 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js @@ -7,9 +7,10 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] +locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); function checkEra(parts) { for (let part of parts) { diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js index 9bbd79ad87c..f4a0763ab4c 100644 --- a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js @@ -7,9 +7,10 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] +locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat([], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); function checkEra(parts) { for (let part of parts) { From 28e653d28d985bea3622b15f9ea8d96ea6ae79f6 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 7 Nov 2025 13:02:34 -0800 Subject: [PATCH 5/7] Pass explicit time zones --- .../Temporal/Instant/prototype/toLocaleString/era.js | 2 +- .../prototype/format/temporal-objects-format-with-era.js | 4 ++-- .../prototype/formatRange/temporal-objects-format-with-era.js | 4 ++-- .../formatRangeToParts/temporal-objects-format-with-era.js | 2 +- .../formatToParts/temporal-objects-format-with-era.js | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js index 2a2c394a832..1618764681f 100644 --- a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js @@ -12,4 +12,4 @@ locales: [en] const instant = new Temporal.Instant(0n); -assert(instant.toLocaleString("en", { era: "narrow" }).startsWith("1"), "toLocaleString on an Instant with era option should work"); +assert(instant.toLocaleString("en", { era: "narrow", timeZone: "UTC" }).startsWith("1"), "toLocaleString on an Instant with era option should work"); diff --git a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js index 03d0d91228a..4cf269eb835 100644 --- a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js @@ -10,11 +10,11 @@ features: [Temporal] locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("2"), "formatting a PlainTime should work"); assert(formatter.format(new Temporal.PlainDateTime(2025, 11, 4, 14, 46)).startsWith("11"), "formatting a PlainDateTime should work"); -assert(formatter.format(new Temporal.Instant(0n)).startsWith("12"), "formatting an Instant should work"); +assert(formatter.format(new Temporal.Instant(0n)).startsWith("1"), "formatting an Instant should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js index 03d0d91228a..4cf269eb835 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js @@ -10,11 +10,11 @@ features: [Temporal] locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("2"), "formatting a PlainTime should work"); assert(formatter.format(new Temporal.PlainDateTime(2025, 11, 4, 14, 46)).startsWith("11"), "formatting a PlainDateTime should work"); -assert(formatter.format(new Temporal.Instant(0n)).startsWith("12"), "formatting an Instant should work"); +assert(formatter.format(new Temporal.Instant(0n)).startsWith("1"), "formatting an Instant should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js index a8758568811..bc3aead80c7 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js @@ -10,7 +10,7 @@ features: [Temporal] locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); function checkEra(parts) { for (let part of parts) { diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js index f4a0763ab4c..4a8b3bfbeb1 100644 --- a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js @@ -10,7 +10,7 @@ features: [Temporal] locales: [en] ---*/ -const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); function checkEra(parts) { for (let part of parts) { From bd540ad97673d99d15728af767fe7e3f940bd445 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Fri, 7 Nov 2025 13:09:08 -0800 Subject: [PATCH 6/7] Fix locales again --- test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js | 2 +- .../Temporal/PlainDate/prototype/toLocaleString/era.js | 2 +- .../Temporal/PlainDateTime/prototype/toLocaleString/era.js | 2 +- .../Temporal/PlainMonthDay/prototype/toLocaleString/era.js | 2 +- .../Temporal/PlainTime/prototype/toLocaleString/era.js | 2 +- .../Temporal/PlainYearMonth/prototype/toLocaleString/era.js | 2 +- .../Temporal/ZonedDateTime/prototype/toLocaleString/era.js | 2 +- .../prototype/format/temporal-objects-format-with-era.js | 2 +- .../prototype/formatRange/temporal-objects-format-with-era.js | 2 +- .../formatRangeToParts/temporal-objects-format-with-era.js | 2 +- .../prototype/formatToParts/temporal-objects-format-with-era.js | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js index 1618764681f..6daee3deec3 100644 --- a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, Instant should be foramtted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const instant = new Temporal.Instant(0n); diff --git a/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js index 3719bdcf559..d6ab1e8fd96 100644 --- a/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainDate/prototype/toLocaleString/era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainDate should be foramtted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const date = new Temporal.PlainDate(2000, 5, 2, "gregory"); diff --git a/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js index b2c986e00b3..eace04aed87 100644 --- a/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainDateTime/prototype/toLocaleString/era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainDateTime should be foramtted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ date = new Temporal.PlainDateTime(2000, 5, 2, 14, 46, 0, 0, 0, 0, "gregory"); diff --git a/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js index 7c00c8d893c..d4f51b418ab 100644 --- a/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainMonthDay should be foramtted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const date = new Temporal.PlainMonthDay(5, 2, "gregory"); diff --git a/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js index 52a547d595d..7f5b59fa3b4 100644 --- a/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainTime/prototype/toLocaleString/era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainTime should be foramtted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const date = new Temporal.PlainTime(14, 46); diff --git a/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js b/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js index d19d28ce73a..7fe4beece1b 100644 --- a/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, PlainYearMonth should be foramtted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const date = new Temporal.PlainYearMonth(2000, 5, "gregory"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js b/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js index cc41ffc8954..1495c9b62a3 100644 --- a/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to toLocaleString, ZonedDateTime should be foramtted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const zdt = new Temporal.ZonedDateTime(0n, "UTC"); diff --git a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js index 4cf269eb835..be3ebcd96c1 100644 --- a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); diff --git a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js index 4cf269eb835..be3ebcd96c1 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); diff --git a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js index bc3aead80c7..15762a93c4b 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js index 4a8b3bfbeb1..8ae3eb48b13 100644 --- a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js @@ -7,7 +7,7 @@ description: > If era option and no other options are provided to DateTimeFormat constructor, objects should be formatted with default options features: [Temporal] -locales: [en] +locale: [en] ---*/ const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); From eb7cd3f84fc20fccc37bbfd906dff942ea734541 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 10 Nov 2025 12:24:56 -0800 Subject: [PATCH 7/7] Remove time zone options --- .../Instant/prototype/toLocaleString/era.js | 4 +++- .../format/temporal-objects-format-with-era.js | 5 +++-- .../temporal-objects-format-with-era.js | 17 +++++++++++------ .../temporal-objects-format-with-era.js | 7 +++---- .../temporal-objects-format-with-era.js | 2 +- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js index 6daee3deec3..4978a0441d3 100644 --- a/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js +++ b/test/built-ins/Temporal/Instant/prototype/toLocaleString/era.js @@ -12,4 +12,6 @@ locale: [en] const instant = new Temporal.Instant(0n); -assert(instant.toLocaleString("en", { era: "narrow", timeZone: "UTC" }).startsWith("1"), "toLocaleString on an Instant with era option should work"); +const instantResult = instant.toLocaleString("en", { era: "narrow" }); +const dateResult = new Date(0).toLocaleString(["en"], { era: "narrow" }); +assert.sameValue(instantResult, dateResult, "toLocaleString on an Instant with era option should return the same results as toLocaleString on the same Date with the same options"); diff --git a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js index be3ebcd96c1..5d889e3478f 100644 --- a/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/format/temporal-objects-format-with-era.js @@ -10,11 +10,12 @@ features: [Temporal] locale: [en] ---*/ -const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("2"), "formatting a PlainTime should work"); assert(formatter.format(new Temporal.PlainDateTime(2025, 11, 4, 14, 46)).startsWith("11"), "formatting a PlainDateTime should work"); -assert(formatter.format(new Temporal.Instant(0n)).startsWith("1"), "formatting an Instant should work"); +assert.sameValue(formatter.format(new Temporal.Instant(0n)), + new Date(0).toLocaleString(["en"], { era: "narrow" }), "toLocaleString on an Instant with era option should return the same results as toLocaleString on the same Date with the same options"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js index be3ebcd96c1..3a79a6e64cf 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRange/temporal-objects-format-with-era.js @@ -12,9 +12,14 @@ locale: [en] const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); -assert(formatter.format(new Temporal.PlainDate(2025, 11, 4)).startsWith("11"), "formatting a PlainDate should work"); -assert(formatter.format(new Temporal.PlainYearMonth(2025, 11, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); -assert(formatter.format(new Temporal.PlainMonthDay(11, 4, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); -assert(formatter.format(new Temporal.PlainTime(14, 46)).startsWith("2"), "formatting a PlainTime should work"); -assert(formatter.format(new Temporal.PlainDateTime(2025, 11, 4, 14, 46)).startsWith("11"), "formatting a PlainDateTime should work"); -assert(formatter.format(new Temporal.Instant(0n)).startsWith("1"), "formatting an Instant should work"); +assert(formatter.formatRange(new Temporal.PlainDate(2025, 11, 4), new Temporal.PlainDate(2025, 11, 5)).startsWith("11"), "formatting a PlainDate should work"); +assert(formatter.formatRange(new Temporal.PlainYearMonth(2025, 11, "gregory"), new Temporal.PlainYearMonth(2025, 12, "gregory")).startsWith("11"), "formatting a PlainYearMonth should work"); +assert(formatter.formatRange(new Temporal.PlainMonthDay(11, 4, "gregory"), new Temporal.PlainMonthDay(11, 14, "gregory")).startsWith("11"), "formatting a PlainMonthDay should work"); +assert(formatter.formatRange(new Temporal.PlainTime(14, 46), new Temporal.PlainTime(17, 46)).startsWith("2"), "formatting a PlainTime should work"); +assert(formatter.formatRange(new Temporal.PlainDateTime(2025, 11, 4, 14, 16, 0, 0, 0, 0, "gregory"), new Temporal.PlainDateTime(2025, 11, 15, 14, 47, 0, 0, 0, 0, "gregory")).startsWith("11"), "formatting a PlainDateTime should work"); + +// For instants, check the output of formatRange on the equivalent Dates and then check that this is a prefix +// of the output of formatRange on the Instants, because the time zone of the host might affect the output +const dateResult = formatter.formatRange(new Date(0), new Date(1)); +assert(formatter.formatRange(new Temporal.Instant(0n), new Temporal.Instant(1000000000n)).startsWith(dateResult), + "formatting an Instant should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js index 15762a93c4b..c6cead9e690 100644 --- a/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-format-with-era.js @@ -10,7 +10,7 @@ features: [Temporal] locale: [en] ---*/ -const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); function checkEra(parts) { for (let part of parts) { @@ -20,10 +20,9 @@ function checkEra(parts) { return false; } -assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDate(2025, 11, 4), new Temporal.PlainDate(2025, 11, 5))), "formatting a PlainDate should work"); -assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDate(2025, 11, 4), new Temporal.PlainDate(2025, 11, 5))), "formatting a PlainDate should work"); +assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDate(2025, 11, 4 , "gregory"), new Temporal.PlainDate(2025, 11, 5, "gregory"))), "formatting a PlainDate should work"); assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainYearMonth(2025, 11, "gregory"), new Temporal.PlainYearMonth(2025, 12, "gregory"))), "formatting a PlainYearMonth should work"); assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainMonthDay(11, 4, "gregory"), new Temporal.PlainMonthDay(11, 14, "gregory"))), "formatting a PlainMonthDay should work"); assert(!checkEra(formatter.formatRangeToParts(new Temporal.PlainTime(14, 46), new Temporal.PlainTime(17, 46))), "formatting a PlainTime should work"); -assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDateTime(2025, 11, 4, 14, 46), new Temporal.PlainDateTime(2025, 11, 15, 14, 47))), "formatting a PlainDateTime should work"); +assert(checkEra(formatter.formatRangeToParts(new Temporal.PlainDateTime(2025, 11, 4, 14, 16, 0, 0, 0, 0, "gregory"), new Temporal.PlainDateTime(2025, 11, 15, 14, 47, 0, 0, 0, 0, "gregory"))), "formatting a PlainDateTime should work"); assert(checkEra(formatter.formatRangeToParts(new Temporal.Instant(0n), new Temporal.Instant(1000000000n))), "formatting an Instant should work"); diff --git a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js index 8ae3eb48b13..cec677c1d84 100644 --- a/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js +++ b/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-format-with-era.js @@ -10,7 +10,7 @@ features: [Temporal] locale: [en] ---*/ -const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow", timeZone: "UTC" }); +const formatter = new Intl.DateTimeFormat(["en"], { era: "narrow" }); function checkEra(parts) { for (let part of parts) {