tor-browser

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

argument-zoneddatetime.js (1226B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2021 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.instant.compare
      7 description: Fast path for converting Temporal.ZonedDateTime to Temporal.Instant
      8 info: |
      9    sec-temporal.instant.compare steps 1–2:
     10      1. Set _one_ to ? ToTemporalInstant(_one_).
     11      2. Set _two_ to ? ToTemporalInstant(_two_).
     12    sec-temporal-totemporalinstant step 1.b:
     13      b. If _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then
     14        i. Return ! CreateTemporalInstant(_item_.[[Nanoseconds]]).
     15 includes: [compareArray.js, temporalHelpers.js]
     16 features: [Temporal]
     17 ---*/
     18 
     19 const instant = new Temporal.Instant(1_000_000_000_000_000_000n);
     20 
     21 TemporalHelpers.checkToTemporalInstantFastPath((datetime) => {
     22  const result = Temporal.Instant.compare(datetime, instant);
     23  assert.sameValue(result, 1, "comparison result");
     24 });
     25 
     26 TemporalHelpers.checkToTemporalInstantFastPath((datetime) => {
     27  const result = Temporal.Instant.compare(instant, datetime);
     28  assert.sameValue(result, -1, "comparison result");
     29 });
     30 
     31 reportCompare(0, 0);