mirror of
https://github.com/tc39/test262.git
synced 2025-11-28 17:43:19 +01:00
Added tests ensuring yearOfWeek and weekOfYear are undefined when
using non-ISO calendar with `PlainDate`, `PlainDateTime`, and `ZonedDateTime`
This commit is contained in:
parent
76cb0928a8
commit
b07d3ad40f
@ -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`
|
||||
);
|
||||
}
|
||||
|
||||
@ -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"
|
||||
);
|
||||
|
||||
@ -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`
|
||||
);
|
||||
}
|
||||
|
||||
@ -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`
|
||||
);
|
||||
}
|
||||
|
||||
@ -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`
|
||||
);
|
||||
}
|
||||
|
||||
@ -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`
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user