Added tests ensuring yearOfWeek and weekOfYear are undefined when

using non-ISO calendar with `PlainDate`, `PlainDateTime`, and
`ZonedDateTime`
This commit is contained in:
Ben Allen 2025-11-18 12:31:06 -08:00 committed by Philip Chimento
parent 76cb0928a8
commit b07d3ad40f
6 changed files with 152 additions and 65 deletions

View File

@ -9,14 +9,29 @@ description: >
features: [Temporal, Intl.Era-monthcode] features: [Temporal, Intl.Era-monthcode]
---*/ ---*/
assert.sameValue( const nonIsoCalendars = [
new Temporal.PlainDate(2024, 1, 1, "gregory").weekOfYear, "buddhist",
undefined, "chinese",
"Gregorian calendar does not provide week numbers" "coptic",
); "dangi",
"ethioaa",
"ethiopic",
"gregory",
"hebrew",
"indian",
"islamic-civil",
"islamic-tbla",
"islamic-umalqura",
"japanese",
"persian",
"roc"
];
for (const calendar of nonIsoCalendars){
assert.sameValue( assert.sameValue(
new Temporal.PlainDate(2024, 1, 1, "hebrew").weekOfYear, new Temporal.PlainDate(2024, 1, 1, calendar).weekOfYear,
undefined, undefined,
"Hebrew calendar does not provide week numbers" `${calendar} does not provide week numbers`
); );
}

View File

@ -9,14 +9,30 @@ description: >
features: [Temporal, Intl.Era-monthcode] features: [Temporal, Intl.Era-monthcode]
---*/ ---*/
assert.sameValue( const nonIsoCalendars = [
new Temporal.PlainDate(2024, 1, 1, "gregory").yearOfWeek, "buddhist",
undefined, "chinese",
"Gregorian calendar does not provide week numbers" "coptic",
); "dangi",
"ethioaa",
"ethiopic",
"gregory",
"hebrew",
"indian",
"islamic-civil",
"islamic-tbla",
"islamic-umalqura",
"japanese",
"persian",
"roc"
];
for (const calendar of nonIsoCalendars) {
assert.sameValue( assert.sameValue(
new Temporal.PlainDate(2024, 1, 1, "hebrew").yearOfWeek, new Temporal.PlainDate(2024, 1, 1, calendar).yearOfWeek,
undefined, undefined,
"Hebrew calendar does not provide week numbers" `${calendar} does not provide week numbers`
); );
}

View File

@ -4,19 +4,33 @@
/*--- /*---
esid: sec-temporal.plaindatetime.prototype.weekofyear esid: sec-temporal.plaindatetime.prototype.weekofyear
description: > 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. non-ISO calendars without a well-defined week numbering system.
features: [Temporal] features: [Temporal, Intl.Era-monthcode]
---*/ ---*/
assert.sameValue( const nonIsoCalendars = [
new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "gregory").weekOfYear, "buddhist",
undefined, "chinese",
"Gregorian calendar does not provide week numbers" "coptic",
); "dangi",
"ethioaa",
"ethiopic",
"gregory",
"hebrew",
"indian",
"islamic-civil",
"islamic-tbla",
"islamic-umalqura",
"japanese",
"persian",
"roc"
];
for (const calendar of nonIsoCalendars) {
assert.sameValue( assert.sameValue(
new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "hebrew").weekOfYear, new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar).weekOfYear,
undefined, undefined,
"Hebrew calendar does not provide week numbers" `${calendar} does not provide week numbers`
); );
}

View File

@ -6,17 +6,31 @@ esid: sec-temporal.plaindatetime.prototype.yearofweek
description: > description: >
Temporal.PlainDateTime.prototype.yearOfWeek returns undefined for all Temporal.PlainDateTime.prototype.yearOfWeek returns undefined for all
non-ISO calendars without a well-defined week numbering system. non-ISO calendars without a well-defined week numbering system.
features: [Temporal] features: [Temporal, Intl.Era-monthcode]
---*/ ---*/
assert.sameValue( const nonIsoCalendars = [
new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "gregory").yearOfWeek, "buddhist",
undefined, "chinese",
"Gregorian calendar does not provide week numbers" "coptic",
); "dangi",
"ethioaa",
"ethiopic",
"gregory",
"hebrew",
"indian",
"islamic-civil",
"islamic-tbla",
"islamic-umalqura",
"japanese",
"persian",
"roc"
];
for (const calendar of nonIsoCalendars) {
assert.sameValue( assert.sameValue(
new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "hebrew").yearOfWeek, new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar).yearOfWeek,
undefined, undefined,
"Hebrew calendar does not provide week numbers" `${calendar} does not provide week numbers`
); );
}

View File

@ -6,17 +6,31 @@ esid: sec-temporal.zoneddatetime.prototype.weekofyear
description: > description: >
Temporal.ZonedDateTime.prototype.weekOfYear returns undefined for all Temporal.ZonedDateTime.prototype.weekOfYear returns undefined for all
non-ISO calendars without a well-defined week numbering system. non-ISO calendars without a well-defined week numbering system.
features: [Temporal] features: [Temporal, Intl.Era-monthcode]
---*/ ---*/
assert.sameValue( const nonIsoCalendars = [
new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "gregory").weekOfYear, "buddhist",
undefined, "chinese",
"Gregorian calendar does not provide week numbers" "coptic",
); "dangi",
"ethioaa",
"ethiopic",
"gregory",
"hebrew",
"indian",
"islamic-civil",
"islamic-tbla",
"islamic-umalqura",
"japanese",
"persian",
"roc"
];
for (const calendar of nonIsoCalendars) {
assert.sameValue( assert.sameValue(
new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "hebrew").weekOfYear, new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar).weekOfYear,
undefined, undefined,
"Hebrew calendar does not provide week numbers" `${calendar} does not provide week numbers`
); );
}

View File

@ -6,17 +6,31 @@ esid: sec-temporal.zoneddatetime.prototype.yearofweek
description: > description: >
Temporal.ZonedDateTime.prototype.yearOfWeek returns undefined for all Temporal.ZonedDateTime.prototype.yearOfWeek returns undefined for all
non-ISO calendars without a well-defined week numbering system. non-ISO calendars without a well-defined week numbering system.
features: [Temporal] features: [Temporal, Intl.Era-monthcode]
---*/ ---*/
assert.sameValue( const nonIsoCalendars = [
new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "gregory").yearOfWeek, "buddhist",
undefined, "chinese",
"Gregorian calendar does not provide week numbers" "coptic",
); "dangi",
"ethioaa",
"ethiopic",
"gregory",
"hebrew",
"indian",
"islamic-civil",
"islamic-tbla",
"islamic-umalqura",
"japanese",
"persian",
"roc"
];
for (const calendar of nonIsoCalendars) {
assert.sameValue( assert.sameValue(
new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "hebrew").yearOfWeek, new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar).yearOfWeek,
undefined, undefined,
"Hebrew calendar does not provide week numbers" `${calendar} does not provide week numbers`
); );
}