tor-browser

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

era-boundary-roc.js (1705B)


      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.zoneddatetime.from
      7 description: Non-positive era years are remapped in roc calendar
      8 includes: [temporalHelpers.js]
      9 features: [Temporal, Intl.Era-monthcode]
     10 ---*/
     11 
     12 const calendar = "roc";
     13 const options = { overflow: "reject" };
     14 
     15 const roc0 = Temporal.ZonedDateTime.from({ era: "roc", eraYear: 0, monthCode: "M01", day: 1, hour: 12, minute: 34, timeZone: "UTC", calendar }, options);
     16 TemporalHelpers.assertPlainDateTime(
     17  roc0.toPlainDateTime(),
     18  0, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "ROC 0 resolves to BROC 1",
     19  "broc", 1);
     20 
     21 const roc1n = Temporal.ZonedDateTime.from({ era: "roc", eraYear: -1, monthCode: "M01", day: 1, hour: 12, minute: 34, timeZone: "UTC", calendar }, options);
     22 TemporalHelpers.assertPlainDateTime(
     23  roc1n.toPlainDateTime(),
     24  -1, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "ROC -1 resolves to BROC 2",
     25  "broc", 2);
     26 
     27 const broc0 = Temporal.ZonedDateTime.from({ era: "broc", eraYear: 0, monthCode: "M01", day: 1, hour: 12, minute: 34, timeZone: "UTC", calendar }, options);
     28 TemporalHelpers.assertPlainDateTime(
     29  broc0.toPlainDateTime(),
     30  1, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "BROC 0 resolves to ROC 1",
     31  "roc", 1);
     32 
     33 const broc1n = Temporal.ZonedDateTime.from({ era: "broc", eraYear: -1, monthCode: "M01", day: 1, hour: 12, minute: 34, timeZone: "UTC", calendar }, options);
     34 TemporalHelpers.assertPlainDateTime(
     35  broc1n.toPlainDateTime(),
     36  2, 1, "M01", 1, 12, 34, 0, 0, 0, 0, "BROC -1 resolves to ROC 2",
     37  "roc", 2);
     38 
     39 reportCompare(0, 0);