tor-browser

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

argument-string-no-implicit-midnight.js (829B)


      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.plaintime.compare
      7 description: RangeError thrown if a date-only string is passed in a PlainTime context
      8 features: [Temporal, arrow-function]
      9 ---*/
     10 
     11 const arg = "2019-10-01";
     12 const midnight = new Temporal.PlainTime();
     13 assert.throws(
     14  RangeError,
     15  () => Temporal.PlainTime.compare(arg, midnight),
     16  "Date-only string throws, does not implicitly convert to midnight (first argument)"
     17 );
     18 assert.throws(
     19  RangeError,
     20  () => Temporal.PlainTime.compare(midnight, arg),
     21  "Date-only string throws, does not implicitly convert to midnight (second argument)"
     22 );
     23 
     24 reportCompare(0, 0);