Debian Codegraph @

js/src/tests/test262/intl402/Temporal/PlainYearMonth/from/canonicalize-era-codes.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2024 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.plainyearmonth.from
7 description: Calendar era code is canonicalized
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const date1 = Temporal.PlainYearMonth.from({
13 calendar: "gregory",
14 era: "ce",
15 eraYear: 2024,
16 year: 2024,
17 month: 1,
18 });
19 TemporalHelpers.assertPlainYearMonth(
20 date1,
21 2024, 1, "M01",
22 "'ce' is accepted as alias for 'gregory'",
23 "gregory", 2024
24 );
25
26 const date2 = Temporal.PlainYearMonth.from({
27 calendar: "gregory",
28 era: "bce",
29 eraYear: 44,
30 year: -43,
31 month: 3,
32 });
33 TemporalHelpers.assertPlainYearMonth(
34 date2,
35 -43, 3, "M03",
36 "'bce' is accepted as alias for 'gregory-inverse'",
37 "gregory-inverse", 44
38 );
39
40 reportCompare(0, 0);