Debian Codegraph @

js/src/tests/test262/intl402/Temporal/PlainDate/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.plaindate.from
7 description: Calendar era code is canonicalized
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const date1 = Temporal.PlainDate.from({
13 calendar: "gregory",
14 era: "ce",
15 eraYear: 2024,
16 year: 2024,
17 month: 1,
18 day: 1
19 });
20 TemporalHelpers.assertPlainDate(
21 date1,
22 2024, 1, "M01", 1,
23 "'ce' is accepted as alias for 'gregory'",
24 "gregory", 2024
25 );
26
27 const date2 = Temporal.PlainDate.from({
28 calendar: "gregory",
29 era: "bce",
30 eraYear: 44,
31 year: -43,
32 month: 3,
33 day: 15
34 });
35 TemporalHelpers.assertPlainDate(
36 date2,
37 -43, 3, "M03", 15,
38 "'bce' is accepted as alias for 'gregory-inverse'",
39 "gregory-inverse", 44
40 );
41
42 reportCompare(0, 0);