1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2024 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 esid: sec-temporal.zoneddatetime.prototype.yearofweek
8 In the ISO 8601 week calendar, calendar week number 1 of a calendar year is
9 the week including the first Thursday of that year (based on the principle
10 that a week belongs to the same calendar year as the majority of its calendar
11 days). Because of this, some calendar days of the first calendar week of a
12 calendar year may be part of the preceding date calendar year, and some
13 calendar days of the last calendar week of a calendar year may be part of
14 the next calendar year.
20 let calendar = new Temporal.Calendar("gregory");
21 const date = new Temporal.ZonedDateTime(1_609_504_496_987_654_321n, "UTC", calendar);
23 assert.sameValue(date.yearOfWeek, 2021);
25 calendar = new Temporal.Calendar("iso8601");
26 const isodate = new Temporal.ZonedDateTime(1_609_504_496_987_654_321n, "UTC", calendar);
28 assert.sameValue(isodate.yearOfWeek, 2020);