tor-browser

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

offset-overrides-critical-flag.js (1163B)


      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: >
      8  The offset option always overrides the critical flag in a time zone annotation
      9 features: [Temporal]
     10 ---*/
     11 
     12 const useResult = Temporal.ZonedDateTime.from("2022-10-07T18:37-07:00[!UTC]", { offset: "use" });
     13 assert.sameValue(
     14  useResult.epochNanoseconds,
     15  1665193020000000000n,
     16  "exact time is unchanged with offset = use, despite critical flag"
     17 );
     18 
     19 const ignoreResult = Temporal.ZonedDateTime.from("2022-10-07T18:37-07:00[!UTC]", { offset: "ignore" });
     20 assert.sameValue(
     21  ignoreResult.epochNanoseconds,
     22  1665167820000000000n,
     23  "wall time is unchanged with offset = ignore, despite critical flag"
     24 );
     25 
     26 const preferResult = Temporal.ZonedDateTime.from("2022-10-07T18:37-07:00[!UTC]", { offset: "prefer" });
     27 assert.sameValue(
     28  useResult.epochNanoseconds,
     29  1665193020000000000n,
     30  "offset is recalculated with offset = prefer, despite critical flag"
     31 );
     32 
     33 reportCompare(0, 0);