tor-browser

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

roundtrip-from-property-bag.js (1068B)


      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: >
      8  Check that various dates created from a property bag have the expected
      9  properties
     10 includes: [temporalHelpers.js]
     11 features: [Temporal, Intl.Era-monthcode]
     12 ---*/
     13 
     14 const options = { overflow: "reject" };
     15 
     16 testRoundtrip(2000);
     17 testRoundtrip(1);
     18 
     19 function testRoundtrip(year) {
     20  const dateFromYearMonth = Temporal.PlainDate.from({ year, month: 1, day: 1 }, options);
     21  TemporalHelpers.assertPlainDate(
     22    dateFromYearMonth,
     23    year, 1, "M01", 1,
     24    `${dateFromYearMonth} - created from year and month`);
     25 
     26  const dateFromYearMonthCode = Temporal.PlainDate.from({ year, monthCode: "M01", day: 1 }, options);
     27  TemporalHelpers.assertPlainDate(
     28    dateFromYearMonthCode,
     29    year, 1, "M01", 1,
     30    `${dateFromYearMonthCode} - created from year and month code`);
     31 }
     32 
     33 reportCompare(0, 0);