tor-browser

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

era-japanese.js (1754B)


      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.prototype.from
      7 description: >
      8  from works properly with eras (Japanese calendar)
      9 includes: [temporalHelpers.js]
     10 features: [Temporal, Intl.Era-monthcode]
     11 ---*/
     12 
     13 const calendar = "japanese";
     14 
     15 const reiwa = Temporal.PlainDate.from({ era: "reiwa", eraYear: 2, month: 1, day: 1,  calendar });
     16 const heisei = Temporal.PlainDate.from({ era: "heisei", eraYear: 2, month: 1, day: 1,  calendar });
     17 const showa = Temporal.PlainDate.from({ era: "showa", eraYear: 2, month: 1, day: 1,  calendar });
     18 const taisho = Temporal.PlainDate.from({ era: "taisho", eraYear: 2, month: 1, day: 1,  calendar });
     19 const meiji = Temporal.PlainDate.from({ era: "meiji", eraYear: 2, month: 1, day: 1,  calendar });
     20 const ce = Temporal.PlainDate.from({ era: "ce", eraYear: 1000, month: 1, day: 1,  calendar });
     21 const bce = Temporal.PlainDate.from({ era: "bce", eraYear: 1, month: 1, day: 1,  calendar });
     22 
     23 TemporalHelpers.assertPlainDate(reiwa, 2020, 1, "M01", 1,  `${reiwa}`, "reiwa", 2);
     24 
     25 TemporalHelpers.assertPlainDate(heisei, 1990, 1, "M01", 1,  `${heisei}`, "heisei", 2);
     26 
     27 TemporalHelpers.assertPlainDate(showa, 1927, 1, "M01", 1,  `${showa}`, "showa", 2);
     28 
     29 TemporalHelpers.assertPlainDate(taisho, 1913, 1, "M01", 1,  `${taisho}`, "taisho", 2);
     30 
     31 TemporalHelpers.assertPlainDate(meiji, 1869, 1, "M01", 1,  `${meiji}`, "meiji", 2);
     32 
     33 TemporalHelpers.assertPlainDate(ce, 1000, 1, "M01", 1,  `${ce} (CE)`, "ce", 1000);
     34 
     35 TemporalHelpers.assertPlainDate(bce, 0, 1, "M01", 1,  `${bce} (BCE)`, "bce", 1);
     36 
     37 reportCompare(0, 0);