tor-browser

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

canonicalize-era-codes-non-gregorian.js (943B)


      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.plaindate.from
      7 description: Calendar era code is canonicalized (non-Gregorian calendars)
      8 features: [Temporal, Intl.Era-monthcode]
      9 ---*/
     10 
     11 
     12 const calendarEraAliases = [
     13  { calendar: "japanese", canonicalizedEra: "ce", alias: "ad" },
     14  { calendar: "japanese", canonicalizedEra: "bce", alias: "bc" }
     15 ];
     16 
     17 
     18 for (const calendarEraAlias of calendarEraAliases) {
     19  const calendar = Temporal.PlainDate.from({
     20    calendar: calendarEraAlias.calendar,
     21    era: calendarEraAlias.alias,
     22    eraYear: 1,
     23    month: 1,
     24    day: 1
     25  });
     26  assert.sameValue(calendar.era, calendarEraAlias.canonicalizedEra, calendar.era + " should canonicalize to " + calendarEraAlias.canonicalizedEra)
     27 }
     28 
     29 reportCompare(0, 0);