tor-browser

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

argument-propertybag-monthcode-month.js (1140B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2022 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: ZonedDateTime can be constructed with monthCode or month; must agree.
      8 includes: [temporalHelpers.js]
      9 features: [Temporal]
     10 ---*/
     11 
     12 // "1976-11-18T00:00:00+01:00[+01:00]"
     13 const expected = new Temporal.ZonedDateTime(217119600000000000n, "+01:00");
     14 
     15 // can be constructed with monthCode and without month
     16 TemporalHelpers.assertZonedDateTimesEqual(Temporal.ZonedDateTime.from({
     17  year: 1976,
     18  monthCode: "M11",
     19  day: 18,
     20  timeZone: "+01:00"
     21 }), expected);
     22 
     23 // can be constructed with month and without monthCode
     24 TemporalHelpers.assertZonedDateTimesEqual(Temporal.ZonedDateTime.from({
     25  year: 1976,
     26  month: 11,
     27  day: 18,
     28  timeZone: "+01:00"
     29 }), expected)
     30 
     31 // month and monthCode must agree
     32 assert.throws(RangeError, () => Temporal.ZonedDateTime.from({
     33  year: 1976,
     34  month: 11,
     35  monthCode: "M12",
     36  day: 18,
     37  timeZone: "+01:00"
     38 }));
     39 
     40 reportCompare(0, 0);