tor-browser

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

era-boundary-gregory.js (1346B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2025 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: Non-positive era years are remapped in gregory calendar
      8 includes: [temporalHelpers.js]
      9 features: [Temporal, Intl.Era-monthcode]
     10 ---*/
     11 
     12 const calendar = "gregory";
     13 const options = { overflow: "reject" };
     14 
     15 const ce0 = Temporal.PlainYearMonth.from({ era: "ce", eraYear: 0, monthCode: "M01", calendar }, options);
     16 TemporalHelpers.assertPlainYearMonth(
     17  ce0,
     18  0, 1, "M01", "CE 0 resolves to BCE 1",
     19  "bce", 1);
     20 
     21 const ce1n = Temporal.PlainYearMonth.from({ era: "ce", eraYear: -1, monthCode: "M01", calendar }, options);
     22 TemporalHelpers.assertPlainYearMonth(
     23  ce1n,
     24  -1, 1, "M01", "CE -1 resolves to BCE 2",
     25  "bce", 2);
     26 
     27 const bce0 = Temporal.PlainYearMonth.from({ era: "bce", eraYear: 0, monthCode: "M01", calendar }, options);
     28 TemporalHelpers.assertPlainYearMonth(
     29  bce0,
     30  1, 1, "M01", "BCE 0 resolves to CE 1",
     31  "ce", 1);
     32 
     33 const bce1n = Temporal.PlainYearMonth.from({ era: "bce", eraYear: -1, monthCode: "M01", calendar }, options);
     34 TemporalHelpers.assertPlainYearMonth(
     35  bce1n,
     36  2, 1, "M01", "BCE -1 resolves to CE 2",
     37  "ce", 2);
     38 
     39 reportCompare(0, 0);