basic.js (932B)
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 7 description: Basic functionality of the Temporal.Instant constructor 8 features: [Temporal] 9 ---*/ 10 11 const bigIntInstant = new Temporal.Instant(217175010123456789n); 12 assert(bigIntInstant instanceof Temporal.Instant, "BigInt instanceof"); 13 assert.sameValue(bigIntInstant.epochMilliseconds, 217175010123, "BigInt epochMilliseconds"); 14 15 const stringInstant = new Temporal.Instant("217175010123456789"); 16 assert(stringInstant instanceof Temporal.Instant, "String instanceof"); 17 assert.sameValue(stringInstant.epochMilliseconds, 217175010123, "String epochMilliseconds"); 18 19 assert.throws(SyntaxError, () => new Temporal.Instant("abc123"), "invalid BigInt syntax"); 20 21 reportCompare(0, 0);