tor-browser

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

calc-epoch-year-hebrew.js (1210B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2024 Mozilla Corporation. 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: Trip on ICU4C bug in the epoch year of the Hebrew calendar
      8 info: https://unicode-org.atlassian.net/browse/ICU-23007
      9 features: [Temporal, Intl.Era-monthcode]
     10 ---*/
     11 
     12 // Rosh Hashanah postponement
     13 {
     14  // Days in Cheshvan and Kislev for years 0..10.
     15  const daysPerMonth = {
     16    Cheshvan: [
     17      29, 30, 30, 29, 29, 30, 30, 29, 29, 30, 29,
     18    ],
     19    Kislev: [
     20      30, 30, 30, 29, 30, 30, 30, 30, 29, 30, 30,
     21    ],
     22  };
     23 
     24  for (let year = 0; year < daysPerMonth.Cheshvan.length; ++year) {
     25    let endOfCheshvan = Temporal.PlainDate.from({
     26      calendar: "hebrew",
     27      year,
     28      monthCode: "M02",
     29      day: 30,
     30    });
     31    assert.sameValue(endOfCheshvan.day, daysPerMonth.Cheshvan[year]);
     32 
     33    let endOfKislev = Temporal.PlainDate.from({
     34      calendar: "hebrew",
     35      year,
     36      monthCode: "M03",
     37      day: 30,
     38    });
     39    assert.sameValue(endOfKislev.day, daysPerMonth.Kislev[year]);
     40  }
     41 }
     42 
     43 
     44 reportCompare(0, 0);