Debian Codegraph @

js/src/tests/test262/intl402/Temporal/ZonedDateTime/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.zoneddatetime.from
7 description: Calendar era code is canonicalized
8 features: [Temporal]
9 ---*/
10
11 const date1 = Temporal.ZonedDateTime.from({
12 calendar: "gregory",
13 era: "ce",
14 eraYear: 2024,
15 year: 2024,
16 month: 1,
17 day: 1,
18 timeZone: "UTC",
19 });
20 assert.sameValue(date1.era, "gregory", "'ce' is accepted as alias for 'gregory'");
21
22 const date2 = Temporal.ZonedDateTime.from({
23 calendar: "gregory",
24 era: "bce",
25 eraYear: 44,
26 year: -43,
27 month: 3,
28 day: 15,
29 timeZone: "Europe/Rome",
30 });
31 assert.sameValue(date2.era, "gregory-inverse", "'bce' is accepted as alias for 'gregory-inverse'");
32
33 reportCompare(0, 0);