From 8fa9d387538332062cbb9736ffdb3e494549fa53 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 14 May 2025 10:20:36 -0700 Subject: [PATCH] Temporal: Make `gregory` week numbers undefined (#4467) --- .../weekOfYear/gregory-iso-weekofyear.js | 27 ------------------- .../weekOfYear/non-iso-week-of-year.js | 22 +++++++-------- .../yearOfWeek/gregory-iso-weekofyear.js | 27 ------------------- .../yearOfWeek/non-iso-week-of-year.js | 22 +++++++-------- .../weekOfYear/gregory-iso-weekofyear.js | 27 ------------------- .../weekOfYear/non-iso-week-of-year.js | 22 +++++++-------- .../yearOfWeek/gregory-iso-weekofyear.js | 27 ------------------- .../yearOfWeek/non-iso-week-of-year.js | 22 +++++++-------- .../construct-non-utc-non-iso.js | 4 +-- .../weekOfYear/gregory-iso-weekofyear.js | 27 ------------------- .../weekOfYear/non-iso-week-of-year.js | 24 ++++++++--------- .../yearOfWeek/gregory-iso-weekofyear.js | 27 ------------------- .../yearOfWeek/non-iso-week-of-year.js | 24 ++++++++--------- 13 files changed, 68 insertions(+), 234 deletions(-) delete mode 100644 test/intl402/Temporal/PlainDate/prototype/weekOfYear/gregory-iso-weekofyear.js delete mode 100644 test/intl402/Temporal/PlainDate/prototype/yearOfWeek/gregory-iso-weekofyear.js delete mode 100644 test/intl402/Temporal/PlainDateTime/prototype/weekOfYear/gregory-iso-weekofyear.js delete mode 100644 test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js delete mode 100644 test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/gregory-iso-weekofyear.js delete mode 100644 test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js diff --git a/test/intl402/Temporal/PlainDate/prototype/weekOfYear/gregory-iso-weekofyear.js b/test/intl402/Temporal/PlainDate/prototype/weekOfYear/gregory-iso-weekofyear.js deleted file mode 100644 index 65d04659e4..0000000000 --- a/test/intl402/Temporal/PlainDate/prototype/weekOfYear/gregory-iso-weekofyear.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindate.prototype.weekofyear -description: > - In the ISO 8601 week calendar, calendar week number 1 of a calendar year is - the week including the first Thursday of that year (based on the principle - that a week belongs to the same calendar year as the majority of its calendar - days). Because of this, some calendar days of the first calendar week of a - calendar year may be part of the preceding date calendar year, and some - calendar days of the last calendar week of a calendar year may be part of - the next calendar year. -features: [Temporal] ----*/ - -// - -let calendar = "gregory"; -const date = new Temporal.PlainDate(2021, 1, 1, calendar); - -assert.sameValue(date.weekOfYear, 1); - -calendar = "iso8601"; -const isodate = new Temporal.PlainDate(2021, 1, 1, calendar); - -assert.sameValue(isodate.weekOfYear, 53); 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 88e9e59314..9636eb6e2b 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 @@ -4,19 +4,19 @@ /*--- esid: sec-temporal.plaindate.prototype.weekofyear description: > - Temporal.PlainDate.prototype.weekOfYear returns undefined for all + Temporal.PlainDate.prototype.weekOfYear returns undefined for all non-ISO calendars without a well-defined week numbering system. features: [Temporal] ---*/ -// Gregorian calendar has a well defined week-numbering system. +assert.sameValue( + new Temporal.PlainDate(2024, 1, 1, "gregory").weekOfYear, + undefined, + "Gregorian calendar does not provide week numbers" +); -let calendar = "gregory"; -const date = new Temporal.PlainDate(2024, 1, 1, calendar); - -assert.sameValue(date.weekOfYear, 1); - -calendar = "hebrew"; -const nonisodate = new Temporal.PlainDate(2024, 1, 1, calendar); - -assert.sameValue(nonisodate.weekOfYear, undefined); +assert.sameValue( + new Temporal.PlainDate(2024, 1, 1, "hebrew").weekOfYear, + undefined, + "Hebrew calendar does not provide week numbers" +); diff --git a/test/intl402/Temporal/PlainDate/prototype/yearOfWeek/gregory-iso-weekofyear.js b/test/intl402/Temporal/PlainDate/prototype/yearOfWeek/gregory-iso-weekofyear.js deleted file mode 100644 index 8de9cc6f34..0000000000 --- a/test/intl402/Temporal/PlainDate/prototype/yearOfWeek/gregory-iso-weekofyear.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindate.prototype.yearofweek -description: > - In the ISO 8601 week calendar, calendar week number 1 of a calendar year is - the week including the first Thursday of that year (based on the principle - that a week belongs to the same calendar year as the majority of its calendar - days). Because of this, some calendar days of the first calendar week of a - calendar year may be part of the preceding date calendar year, and some - calendar days of the last calendar week of a calendar year may be part of - the next calendar year. -features: [Temporal] ----*/ - -// - -let calendar = "gregory"; -const date = new Temporal.PlainDate(2021, 1, 1, calendar); - -assert.sameValue(date.yearOfWeek, 2021); - -calendar = "iso8601"; -const isodate = new Temporal.PlainDate(2021, 1, 1, calendar); - -assert.sameValue(isodate.yearOfWeek, 2020); 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 5d0190e259..051718d148 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 @@ -4,19 +4,19 @@ /*--- esid: sec-temporal.plaindate.prototype.yearofweek description: > - Temporal.PlainDate.prototype.yearOfWeek returns undefined for all + Temporal.PlainDate.prototype.yearOfWeek returns undefined for all non-ISO calendars without a well-defined week numbering system. features: [Temporal] ---*/ -// Gregorian calendar has a well defined week-numbering system. +assert.sameValue( + new Temporal.PlainDate(2024, 1, 1, "gregory").yearOfWeek, + undefined, + "Gregorian calendar does not provide week numbers" +); -let calendar = "gregory"; -const date = new Temporal.PlainDate(2024, 1, 1, calendar); - -assert.sameValue(date.yearOfWeek, 2024); - -calendar = "hebrew"; -const nonisodate = new Temporal.PlainDate(2024, 1, 1, calendar); - -assert.sameValue(nonisodate.yearOfWeek, undefined); +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/gregory-iso-weekofyear.js b/test/intl402/Temporal/PlainDateTime/prototype/weekOfYear/gregory-iso-weekofyear.js deleted file mode 100644 index 65f75d4a64..0000000000 --- a/test/intl402/Temporal/PlainDateTime/prototype/weekOfYear/gregory-iso-weekofyear.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.weekofyear -description: > - In the ISO 8601 week calendar, calendar week number 1 of a calendar year is - the week including the first Thursday of that year (based on the principle - that a week belongs to the same calendar year as the majority of its calendar - days). Because of this, some calendar days of the first calendar week of a - calendar year may be part of the preceding date calendar year, and some - calendar days of the last calendar week of a calendar year may be part of - the next calendar year. -features: [Temporal] ----*/ - -// - -let calendar = "gregory"; -const date = new Temporal.PlainDateTime(2021, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(date.weekOfYear, 1); - -calendar = "iso8601"; -const isodate = new Temporal.PlainDateTime(2021, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(isodate.weekOfYear, 53); 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 56077f2e76..19fa29cd46 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,19 @@ /*--- esid: sec-temporal.plaindatetime.prototype.weekofyear description: > - Temporal.PlainDateTime.prototype.weekOfYear returns undefined for all + Temporal.PlainDateTime.prototype.weekOfYear returns undefined for all non-ISO calendars without a well-defined week numbering system. features: [Temporal] ---*/ -// Gregorian calendar has a well defined week-numbering system. +assert.sameValue( + new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "gregory").weekOfYear, + undefined, + "Gregorian calendar does not provide week numbers" +); -let calendar = "gregory"; -const date = new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(date.weekOfYear, 1); - -calendar = "hebrew"; -const nonisodate = new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(nonisodate.weekOfYear, undefined); +assert.sameValue( + new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "hebrew").weekOfYear, + undefined, + "Hebrew calendar does not provide week numbers" +); diff --git a/test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js b/test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js deleted file mode 100644 index 20034007f9..0000000000 --- a/test/intl402/Temporal/PlainDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.plaindatetime.prototype.yearofweek -description: > - In the ISO 8601 week calendar, calendar week number 1 of a calendar year is - the week including the first Thursday of that year (based on the principle - that a week belongs to the same calendar year as the majority of its calendar - days). Because of this, some calendar days of the first calendar week of a - calendar year may be part of the preceding date calendar year, and some - calendar days of the last calendar week of a calendar year may be part of - the next calendar year. -features: [Temporal] ----*/ - -// - -let calendar = "gregory"; -const date = new Temporal.PlainDateTime(2021, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(date.yearOfWeek, 2021); - -calendar = "iso8601"; -const isodate = new Temporal.PlainDateTime(2021, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(isodate.yearOfWeek, 2020); 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 8157aa1414..fa1f4d4fac 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 @@ -4,19 +4,19 @@ /*--- esid: sec-temporal.plaindatetime.prototype.yearofweek 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. features: [Temporal] ---*/ -// Gregorian calendar has a well defined week-numbering system. +assert.sameValue( + new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "gregory").yearOfWeek, + undefined, + "Gregorian calendar does not provide week numbers" +); -let calendar = "gregory"; -const date = new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(date.yearOfWeek, 2024); - -calendar = "hebrew"; -const nonisodate = new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar); - -assert.sameValue(nonisodate.yearOfWeek, undefined); +assert.sameValue( + new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, "hebrew").yearOfWeek, + undefined, + "Hebrew calendar does not provide week numbers" +); diff --git a/test/intl402/Temporal/ZonedDateTime/construct-non-utc-non-iso.js b/test/intl402/Temporal/ZonedDateTime/construct-non-utc-non-iso.js index 37454406c1..e1347e655e 100644 --- a/test/intl402/Temporal/ZonedDateTime/construct-non-utc-non-iso.js +++ b/test/intl402/Temporal/ZonedDateTime/construct-non-utc-non-iso.js @@ -39,8 +39,8 @@ assert.sameValue(instance.epochNanoseconds, 217178610123456789n, "epochNanosecon assert.sameValue(instance.dayOfWeek, 4, "dayOfWeek"); assert.sameValue(instance.dayOfYear, 323, "dayOfYear"); -assert.sameValue(instance.weekOfYear, 47, "weekOfYear"); -assert.sameValue(instance.yearOfWeek, 1976, "yearOfWeek"); +assert.sameValue(instance.weekOfYear, undefined, "weekOfYear"); +assert.sameValue(instance.yearOfWeek, undefined, "yearOfWeek"); assert.sameValue(instance.daysInWeek, 7, "daysInWeek"); assert.sameValue(instance.daysInMonth, 30, "daysInMonth"); assert.sameValue(instance.daysInYear, 366, "daysInYear"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/gregory-iso-weekofyear.js b/test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/gregory-iso-weekofyear.js deleted file mode 100644 index e9c2477db6..0000000000 --- a/test/intl402/Temporal/ZonedDateTime/prototype/weekOfYear/gregory-iso-weekofyear.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.weekofyear -description: > - In the ISO 8601 week calendar, calendar week number 1 of a calendar year is - the week including the first Thursday of that year (based on the principle - that a week belongs to the same calendar year as the majority of its calendar - days). Because of this, some calendar days of the first calendar week of a - calendar year may be part of the preceding date calendar year, and some - calendar days of the last calendar week of a calendar year may be part of - the next calendar year. -features: [Temporal] ----*/ - -// - -let calendar = "gregory"; -const date = new Temporal.ZonedDateTime(1_609_504_496_987_654_321n, "UTC", calendar); - -assert.sameValue(date.weekOfYear, 1); - -calendar = "iso8601"; -const isodate = new Temporal.ZonedDateTime(1_609_504_496_987_654_321n, "UTC", calendar); - -assert.sameValue(isodate.weekOfYear, 53); 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 eb85685685..b1954a67ba 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 @@ -4,21 +4,19 @@ /*--- esid: sec-temporal.zoneddatetime.prototype.weekofyear 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. features: [Temporal] ---*/ -// Gregorian calendar has a well defined week-numbering system. +assert.sameValue( + new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "gregory").weekOfYear, + undefined, + "Gregorian calendar does not provide week numbers" +); -let calendar = "gregory"; - -// Epoch Nanoseconds for new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar); -const date = new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar); - -assert.sameValue(date.weekOfYear, 1); - -calendar = "hebrew"; -const nonisodate = new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar); - -assert.sameValue(nonisodate.weekOfYear, undefined); +assert.sameValue( + new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "hebrew").weekOfYear, + undefined, + "Hebrew calendar does not provide week numbers" +); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js b/test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js deleted file mode 100644 index f7b22ab358..0000000000 --- a/test/intl402/Temporal/ZonedDateTime/prototype/yearOfWeek/gregory-iso-weekofyear.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.zoneddatetime.prototype.yearofweek -description: > - In the ISO 8601 week calendar, calendar week number 1 of a calendar year is - the week including the first Thursday of that year (based on the principle - that a week belongs to the same calendar year as the majority of its calendar - days). Because of this, some calendar days of the first calendar week of a - calendar year may be part of the preceding date calendar year, and some - calendar days of the last calendar week of a calendar year may be part of - the next calendar year. -features: [Temporal] ----*/ - -// - -let calendar = "gregory"; -const date = new Temporal.ZonedDateTime(1_609_504_496_987_654_321n, "UTC", calendar); - -assert.sameValue(date.yearOfWeek, 2021); - -calendar = "iso8601"; -const isodate = new Temporal.ZonedDateTime(1_609_504_496_987_654_321n, "UTC", calendar); - -assert.sameValue(isodate.yearOfWeek, 2020); 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 55e8d624ee..f6f3e59f10 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 @@ -4,21 +4,19 @@ /*--- esid: sec-temporal.zoneddatetime.prototype.yearofweek 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. features: [Temporal] ---*/ -// Gregorian calendar has a well defined week-numbering system. +assert.sameValue( + new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "gregory").yearOfWeek, + undefined, + "Gregorian calendar does not provide week numbers" +); -let calendar = "gregory"; - -// Epoch Nanoseconds for new Temporal.PlainDateTime(2024, 1, 1, 12, 34, 56, 987, 654, 321, calendar); -const date = new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar); - -assert.sameValue(date.yearOfWeek, 2024); - -calendar = "hebrew"; -const nonisodate = new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", calendar); - -assert.sameValue(nonisodate.yearOfWeek, undefined); +assert.sameValue( + new Temporal.ZonedDateTime(1_704_112_496_987_654_321n, "UTC", "hebrew").yearOfWeek, + undefined, + "Hebrew calendar does not provide week numbers" +);