tor-browser

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

argument-propertybag-timezone-string-datetime.js (1921B)


      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.compare
      7 description: Conversion of ISO date-time strings to Temporal.TimeZone instances (with IANA time zones)
      8 features: [Temporal]
      9 ---*/
     10 
     11 const instance = new Temporal.ZonedDateTime(1588402800_000_000_000n, "America/Vancouver")
     12 
     13 let timeZone = "2021-08-19T17:30[America/Vancouver]";
     14 const result1 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance);
     15 assert.sameValue(result1, 0, "date-time + IANA annotation is the IANA time zone (first argument)");
     16 const result2 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone });
     17 assert.sameValue(result1, 0, "date-time + IANA annotation is the IANA time zone (second argument)");
     18 
     19 timeZone = "2021-08-19T17:30Z[America/Vancouver]";
     20 const result3 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance);
     21 assert.sameValue(result3, 0, "date-time + Z + IANA annotation is the IANA time zone (first argument)");
     22 const result4 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone });
     23 assert.sameValue(result4, 0, "date-time + Z + IANA annotation is the IANA time zone (second argument)");
     24 
     25 timeZone = "2021-08-19T17:30-07:00[America/Vancouver]";
     26 const result5 = Temporal.ZonedDateTime.compare({ year: 2020, month: 5, day: 2, timeZone }, instance);
     27 assert.sameValue(result5, 0, "date-time + offset + IANA annotation is the IANA time zone (first argument)");
     28 const result6 = Temporal.ZonedDateTime.compare(instance, { year: 2020, month: 5, day: 2, timeZone });
     29 assert.sameValue(result6, 0, "date-time + offset + IANA annotation is the IANA time zone (second argument)");
     30 
     31 reportCompare(0, 0);