tor-browser

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

non-positive-single-era-year.js (1006B)


      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 in calendars with a single era
      8 includes: [temporalHelpers.js]
      9 features: [Temporal, Intl.Era-monthcode]
     10 ---*/
     11 
     12 const calendarEras = {
     13  buddhist: "be",
     14  coptic: "am",
     15  ethioaa: "aa",
     16  hebrew: "am",
     17  indian: "shaka",
     18  persian: "ap",
     19 };
     20 const options = { overflow: "reject" };
     21 
     22 for (const [calendar, era] of Object.entries(calendarEras)) {
     23  for (const eraYear of [-1, 0, 1]) {
     24    const date = Temporal.PlainDateTime.from({ era, eraYear, monthCode: "M01", day: 1, hour: 12, minute: 34, calendar }, options);
     25    TemporalHelpers.assertPlainDateTime(
     26      date,
     27      eraYear, 1, "M01", 1, 12, 34, 0, 0, 0, 0, `era year ${eraYear} is not remapped`,
     28      era, eraYear);
     29  }
     30 }
     31 
     32 reportCompare(0, 0);