tor-browser

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

offset-undefined.js (1342B)


      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.zoneddatetime.from
      7 description: Fallback value for offset option
      8 info: |
      9    sec-getoption step 3:
     10      3. If _value_ is *undefined*, return _fallback_.
     11    sec-temporal-totemporaloffset step 1:
     12      1. Return ? GetOption(_normalizedOptions_, *"offset"*, « String », « *"prefer"*, *"use"*, *"ignore"*, *"reject"* », _fallback_).
     13    sec-temporal-totemporalzoneddatetime step 6:
     14      6. Let _offset_ be ? ToTemporalOffset(_options_, *"reject"*).
     15    sec-temporal.zoneddatetime.from step 2:
     16      2. If Type(_item_) is Object and _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then
     17        ...
     18        c. Perform ? ToTemporalOffset(_options_, *"reject"*).
     19        d. Return ...
     20      3. Return ? ToTemporalZonedDateTime(_item_, _options_).
     21 features: [Temporal]
     22 ---*/
     23 
     24 const propertyBag = { timeZone: "-04:00", offset: "+01:00", year: 2020, month: 2, day: 16, hour: 23, minute: 45 };
     25 
     26 assert.throws(RangeError, () => Temporal.ZonedDateTime.from(propertyBag, { offset: undefined }), "default offset is reject");
     27 // See options-undefined.js for {}
     28 
     29 reportCompare(0, 0);