tor-browser

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

argument-leap-second.js (1277B)


      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.plaindate.from
      7 description: Leap second is a valid ISO string for PlainDate
      8 includes: [temporalHelpers.js]
      9 features: [Temporal]
     10 ---*/
     11 
     12 let arg = "2016-12-31T23:59:60";
     13 
     14 const result1 = Temporal.PlainDate.from(arg);
     15 TemporalHelpers.assertPlainDate(
     16  result1,
     17  2016, 12, "M12", 31,
     18  "leap second is a valid ISO string for PlainDate"
     19 );
     20 
     21 const result2 = Temporal.PlainDate.from(arg, { overflow: "reject" });
     22 TemporalHelpers.assertPlainDate(
     23  result2,
     24  2016, 12, "M12", 31,
     25  "leap second is a valid ISO string for PlainDate"
     26 );
     27 
     28 arg = { year: 2016, month: 12, day: 31, hour: 23, minute: 59, second: 60 };
     29 
     30 const result3 = Temporal.PlainDate.from(arg);
     31 TemporalHelpers.assertPlainDate(
     32  result3,
     33  2016, 12, "M12", 31,
     34  "second: 60 is ignored in property bag for PlainDate"
     35 );
     36 
     37 const result4 = Temporal.PlainDate.from(arg, { overflow: "reject" });
     38 TemporalHelpers.assertPlainDate(
     39  result4,
     40  2016, 12, "M12", 31,
     41  "second: 60 is ignored in property bag for PlainDate even with overflow: reject"
     42 );
     43 
     44 reportCompare(0, 0);