tor-browser

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

leap-year-hebrew.js (1500B)


      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: Basic functionality of resolving fields in hebrew calendar leap year
      8 features: [Temporal, Intl.Era-monthcode]
      9 includes: [temporalHelpers.js]
     10 ---*/
     11 
     12 const calendar = "hebrew";
     13 const options = { overflow: "reject" };
     14 
     15 const leapYear = 5784;
     16 const monthLengths5784 = [
     17  undefined,
     18  ["M01", 30],
     19  ["M02", 29],
     20  ["M03", 29],
     21  ["M04", 29],
     22  ["M05", 30],
     23  ["M05L", 30],
     24  ["M06", 29],
     25  ["M07", 30],
     26  ["M08", 29],
     27  ["M09", 30],
     28  ["M10", 29],
     29  ["M11", 30],
     30  ["M12", 29]
     31 ];
     32 
     33 for (let month = 1; month < 14; month++) {
     34  const [monthCode, day] = monthLengths5784[month];
     35 
     36  const startOfMonth = Temporal.PlainDateTime.from({ year: leapYear, month, day: 1, hour: 12, minute: 34, calendar }, options);
     37  TemporalHelpers.assertPlainDateTime(
     38    startOfMonth,
     39    leapYear, month, monthCode, 1, 12, 34, 0, 0, 0, 0,
     40    `Start of month ${monthCode} in leap year`,
     41    "am", leapYear
     42  );
     43 
     44  const endOfMonth = Temporal.PlainDateTime.from({ year: leapYear, month, day, hour: 12, minute: 34, calendar }, options);
     45  TemporalHelpers.assertPlainDateTime(
     46    endOfMonth,
     47    leapYear, month, monthCode, day, 12, 34, 0, 0, 0, 0,
     48    `End of month ${monthCode} in leap year`,
     49    "am", leapYear
     50  );
     51 }
     52 
     53 
     54 reportCompare(0, 0);