From b07d3ad40fecb113e3a98d94a05953b27c042ca6 Mon Sep 17 00:00:00 2001 From: Ben Allen Date: Tue, 18 Nov 2025 12:31:06 -0800 Subject: [PATCH] Added tests ensuring `yearOfWeek` and `weekOfYear` are `undefined` when using non-ISO calendar with `PlainDate`, `PlainDateTime`, and `ZonedDateTime` --- .../weekOfYear/non-iso-week-of-year.js | 35 ++++++++++++----- .../yearOfWeek/non-iso-week-of-year.js | 36 +++++++++++++----- .../weekOfYear/non-iso-week-of-year.js | 38 +++++++++++++------ .../yearOfWeek/non-iso-week-of-year.js | 36 ++++++++++++------ .../weekOfYear/non-iso-week-of-year.js | 36 ++++++++++++------ .../yearOfWeek/non-iso-week-of-year.js | 36 ++++++++++++------ 6 files changed, 152 insertions(+), 65 deletions(-) diff --git a/test/intl402/Temporal/PlainDate/prototype/weekOfYear/non-iso-week-of-year.js b/test/intl402/Temporal/PlainDate/prototype/weekOfYear/non-iso-week-of-year.js index 10448418e9..36752b53d9 100644 --- a/test/intl402/Temporal/PlainDate/prototype/weekOfYear/non-iso-week-of-year.js +++ b/test/intl402/Temporal/PlainDate/prototype/weekOfYear/non-iso-week-of-year.js @@ -9,14 +9,29 @@ description: > features: [Temporal, Intl.Era-monthcode] ---*/ -assert.sameValue( - new Temporal.PlainDate(2024, 1, 1, "gregory").weekOfYear, - undefined, - "Gregorian calendar does not provide week numbers" -); +const nonIsoCalendars = [ + "buddhist", + "chinese", + "coptic", + "dangi", + "ethioaa", + "ethiopic", + "gregory", + "hebrew", + "indian", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "japanese", + "persian", + "roc" +]; -assert.sameValue( - new Temporal.PlainDate(2024, 1, 1, "hebrew").weekOfYear, - undefined, - "Hebrew calendar does not provide week numbers" -); + +for (const calendar of nonIsoCalendars){ + assert.sameValue( + new Temporal.PlainDate(2024, 1, 1, calendar).weekOfYear, + undefined, + `${calendar} does not provide week numbers` + ); +} diff --git a/test/intl402/Temporal/PlainDate/prototype/yearOfWeek/non-iso-week-of-year.js b/test/intl402/Temporal/PlainDate/prototype/yearOfWeek/non-iso-week-of-year.js index 21a018e906..f43cfea91c 100644 --- a/test/intl402/Temporal/PlainDate/prototype/yearOfWeek/non-iso-week-of-year.js +++ b/test/intl402/Temporal/PlainDate/prototype/yearOfWeek/non-iso-week-of-year.js @@ -9,14 +9,30 @@ description: > features: [Temporal, Intl.Era-monthcode] ---*/ -assert.sameValue( - new Temporal.PlainDate(2024, 1, 1, "gregory").yearOfWeek, - undefined, - "Gregorian calendar does not provide week numbers" -); +const nonIsoCalendars = [ + "buddhist", + "chinese", + "coptic", + "dangi", + "ethioaa", + "ethiopic", + "gregory", + "hebrew", + "indian", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "japanese", + "persian", + "roc" +]; + + +for (const calendar of nonIsoCalendars) { + assert.sameValue( + new Temporal.PlainDate(2024, 1, 1, calendar).yearOfWeek, + undefined, + `${calendar} does not provide week numbers` + ); +} -assert.sameValue( - new Temporal.PlainDate(2024, 1, 1, "hebrew").yearOfWeek, - undefined, - "Hebrew calendar does not provide week numbers" -); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/weekOfYear/non-iso-week-of-year.js b/test/intl402/Temporal/PlainDateTime/prototype/weekOfYear/non-iso-week-of-year.js index 19fa29cd46..66406fc256 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/weekOfYear/non-iso-week-of-year.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/weekOfYear/non-iso-week-of-year.js @@ -4,19 +4,33 @@ /*--- esid: sec-temporal.plaindatetime.prototype.weekofyear description: > - Temporal.PlainDateTime.prototype.weekOfYear returns undefined for all + Temporal.PlainDateTimeTime.prototype.weekOfYear returns undefined for all non-ISO calendars without a well-defined week numbering system. -features: [Temporal] +features: [Temporal, Intl.Era-monthcode] ---*/ -assert.sameValue( - new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "gregory").weekOfYear, - undefined, - "Gregorian calendar does not provide week numbers" -); +const nonIsoCalendars = [ + "buddhist", + "chinese", + "coptic", + "dangi", + "ethioaa", + "ethiopic", + "gregory", + "hebrew", + "indian", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "japanese", + "persian", + "roc" +]; -assert.sameValue( - new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "hebrew").weekOfYear, - undefined, - "Hebrew calendar does not provide week numbers" -); +for (const calendar of nonIsoCalendars) { + assert.sameValue( + new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar).weekOfYear, + undefined, + `${calendar} does not provide week numbers` + ); +} diff --git a/test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/non-iso-week-of-year.js b/test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/non-iso-week-of-year.js index fa1f4d4fac..7d0fe98879 100644 --- a/test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/non-iso-week-of-year.js +++ b/test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/non-iso-week-of-year.js @@ -6,17 +6,31 @@ esid: sec-temporal.plaindatetime.prototype.yearofweek description: > Temporal.PlainDateTime.prototype.yearOfWeek returns undefined for all non-ISO calendars without a well-defined week numbering system. -features: [Temporal] +features: [Temporal, Intl.Era-monthcode] ---*/ -assert.sameValue( - new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "gregory").yearOfWeek, - undefined, - "Gregorian calendar does not provide week numbers" -); +const nonIsoCalendars = [ + "buddhist", + "chinese", + "coptic", + "dangi", + "ethioaa", + "ethiopic", + "gregory", + "hebrew", + "indian", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "japanese", + "persian", + "roc" +]; -assert.sameValue( - new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "hebrew").yearOfWeek, - undefined, - "Hebrew calendar does not provide week numbers" -); +for (const calendar of nonIsoCalendars) { + assert.sameValue( + new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar).yearOfWeek, + undefined, + `${calendar} does not provide week numbers` + ); +} diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/non-iso-week-of-year.js b/test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/non-iso-week-of-year.js index b1954a67ba..ae489ebe0f 100644 --- a/test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/non-iso-week-of-year.js +++ b/test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/non-iso-week-of-year.js @@ -6,17 +6,31 @@ esid: sec-temporal.zoneddatetime.prototype.weekofyear description: > Temporal.ZonedDateTime.prototype.weekOfYear returns undefined for all non-ISO calendars without a well-defined week numbering system. -features: [Temporal] +features: [Temporal, Intl.Era-monthcode] ---*/ -assert.sameValue( - new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "gregory").weekOfYear, - undefined, - "Gregorian calendar does not provide week numbers" -); +const nonIsoCalendars = [ + "buddhist", + "chinese", + "coptic", + "dangi", + "ethioaa", + "ethiopic", + "gregory", + "hebrew", + "indian", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "japanese", + "persian", + "roc" +]; -assert.sameValue( - new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "hebrew").weekOfYear, - undefined, - "Hebrew calendar does not provide week numbers" -); +for (const calendar of nonIsoCalendars) { + assert.sameValue( + new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar).weekOfYear, + undefined, + `${calendar} does not provide week numbers` + ); +} diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/non-iso-week-of-year.js b/test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/non-iso-week-of-year.js index f6f3e59f10..858a0df44f 100644 --- a/test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/non-iso-week-of-year.js +++ b/test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/non-iso-week-of-year.js @@ -6,17 +6,31 @@ esid: sec-temporal.zoneddatetime.prototype.yearofweek description: > Temporal.ZonedDateTime.prototype.yearOfWeek returns undefined for all non-ISO calendars without a well-defined week numbering system. -features: [Temporal] +features: [Temporal, Intl.Era-monthcode] ---*/ -assert.sameValue( - new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "gregory").yearOfWeek, - undefined, - "Gregorian calendar does not provide week numbers" -); +const nonIsoCalendars = [ + "buddhist", + "chinese", + "coptic", + "dangi", + "ethioaa", + "ethiopic", + "gregory", + "hebrew", + "indian", + "islamic-civil", + "islamic-tbla", + "islamic-umalqura", + "japanese", + "persian", + "roc" +]; -assert.sameValue( - new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "hebrew").yearOfWeek, - undefined, - "Hebrew calendar does not provide week numbers" -); +for (const calendar of nonIsoCalendars) { + assert.sameValue( + new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar).yearOfWeek, + undefined, + `${calendar} does not provide week numbers` + ); +}