Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / intl402 / Temporal / Calendar / prototype / yearOfWeek / gregory-iso-weekofyear.js
blobff2d9c0b60339c16e3fc308396fe5dfc68f774da
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.
5 /*---
6 esid: sec-temporal.calendar.prototype.yearofweek
7 description: >
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.
15 features: [Temporal]
16 ---*/
18 // 
20 let calendar = new Temporal.Calendar("gregory");
21 const date = { month: 1, day: 1, year: 2021, calendar};
23 assert.sameValue(calendar.yearOfWeek({...date}), 2021);
25 calendar = new Temporal.Calendar("iso8601");
26 const isodate = { month: 1, day: 1, year: 2021, calendar};
28 assert.sameValue(calendar.yearOfWeek({...isodate}), 2020);
30 reportCompare(0, 0);