tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

canonicalize-era-codes.js (915B)


      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.
      4 
      5 /*---
      6 esid: sec-temporal.plainyearmonth.from
      7 description: Calendar era code is canonicalized
      8 includes: [temporalHelpers.js]
      9 features: [Temporal, Intl.Era-monthcode]
     10 ---*/
     11 
     12 const date1 = Temporal.PlainYearMonth.from({
     13  calendar: "gregory",
     14  era: "ad",
     15  eraYear: 2024,
     16  year: 2024,
     17  month: 1,
     18 });
     19 TemporalHelpers.assertPlainYearMonth(
     20  date1,
     21  2024, 1, "M01",
     22  "'ad' is accepted as alias for 'ce'",
     23  "ce", 2024
     24 );
     25 
     26 const date2 = Temporal.PlainYearMonth.from({
     27  calendar: "gregory",
     28  era: "bc",
     29  eraYear: 44,
     30  year: -43,
     31  month: 3,
     32 });
     33 TemporalHelpers.assertPlainYearMonth(
     34  date2,
     35  -43, 3, "M03",
     36  "'bc' is accepted as alias for 'bce'",
     37  "bce", 44
     38 );
     39 
     40 reportCompare(0, 0);