tor-browser

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

era-boundary-ethiopic.js (1558B)


      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.plaindatetime.from
      7 description: Non-positive era years are remapped in ethiopic calendar
      8 includes: [temporalHelpers.js]
      9 features: [Temporal, Intl.Era-monthcode]
     10 ---*/
     11 
     12 const calendar = "ethiopic";
     13 const options = { overflow: "reject" };
     14 
     15 const am0 = Temporal.PlainDateTime.from({ era: "am", eraYear: 0, monthCode: "M01", day: 1, hour: 12, minute: 34, calendar }, options);
     16 TemporalHelpers.assertPlainDateTime(
     17  am0,
     18  0, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "AM 0 resolves to AA 5500",
     19  "aa", 5500);
     20 
     21 const am1n = Temporal.PlainDateTime.from({ era: "am", eraYear: -1, monthCode: "M01", day: 1, hour: 12, minute: 34, calendar }, options);
     22 TemporalHelpers.assertPlainDateTime(
     23  am1n,
     24  -1, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "AM -1 resolves to AA 5499",
     25  "aa", 5499);
     26 
     27 const aa0 = Temporal.PlainDateTime.from({ era: "aa", eraYear: 0, monthCode: "M01", day: 1, hour: 12, minute: 34, calendar }, options);
     28 TemporalHelpers.assertPlainDateTime(
     29  aa0,
     30  -5500, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "AA 0 is not remapped",
     31  "aa", 0);
     32 
     33 const aa1n = Temporal.PlainDateTime.from({ era: "aa", eraYear: -1, monthCode: "M01", day: 1, hour: 12, minute: 34, calendar }, options);
     34 TemporalHelpers.assertPlainDateTime(
     35  aa1n,
     36  -5501, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "AA -1 is not remapped",
     37  "aa", -1);
     38 
     39 reportCompare(0, 0);