tor-browser

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

relativeto-hour.js (1336B)


      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.duration.compare
      7 description: relativeTo with hours.
      8 features: [Temporal]
      9 ---*/
     10 
     11 const oneDay = new Temporal.Duration(0, 0, 0, 1);
     12 const hours24 = new Temporal.Duration(0, 0, 0, 0, 24);
     13 
     14 assert.sameValue(
     15  Temporal.Duration.compare(oneDay, hours24, { relativeTo: Temporal.ZonedDateTime.from('2017-01-01T00:00[America/Montevideo]') }),
     16  0,
     17  'relativeTo does not affect days if ZonedDateTime, and duration encompasses no DST change');
     18 assert.sameValue(
     19  Temporal.Duration.compare(oneDay, hours24, { relativeTo: Temporal.ZonedDateTime.from('2019-11-03T00:00[America/Vancouver]') }),
     20  1,
     21  'relativeTo does affect days if ZonedDateTime, and duration encompasses DST change');
     22 assert.sameValue(
     23  Temporal.Duration.compare(oneDay, hours24, { relativeTo: '2019-11-03T00:00[America/Vancouver]' }),
     24  1,
     25  'casts relativeTo to ZonedDateTime from string');
     26 assert.sameValue(
     27  Temporal.Duration.compare(oneDay, hours24, {
     28    relativeTo: { year: 2019, month: 11, day: 3, timeZone: 'America/Vancouver' }
     29  }),
     30  1,
     31  'casts relativeTo to ZonedDateTime from object');
     32 
     33 
     34 reportCompare(0, 0);