tor-browser

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

cast.js (1121B)


      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.plaindatetime.compare
      7 description: Arguments may be casted (string, plain object)
      8 features: [Temporal]
      9 ---*/
     10 
     11 const dt1 = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789);
     12 const dt2 = new Temporal.PlainDateTime(2019, 10, 29, 10, 46, 38, 271, 986, 102);
     13 
     14 assert.sameValue(
     15  Temporal.PlainDateTime.compare({ year: 1976, month: 11, day: 18, hour: 15 }, dt2),
     16  -1,
     17  "casts first argument (plain object)"
     18 );
     19 
     20 assert.sameValue(
     21  Temporal.PlainDateTime.compare("1976-11-18T15:23:30.123456789", dt2),
     22  -1,
     23  "casts first argument (string)"
     24 );
     25 
     26 assert.sameValue(
     27  Temporal.PlainDateTime.compare(dt1, { year: 2019, month: 10, day: 29, hour: 10 }),
     28  -1,
     29  "casts second argument (plain object)"
     30 );
     31 
     32 assert.sameValue(
     33  Temporal.PlainDateTime.compare(dt1, "2019-10-29T10:46:38.271986102"),
     34  -1,
     35  "casts second argument (string)"
     36 );
     37 
     38 reportCompare(0, 0);