argument-string-time-separators.js (950B)
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: Time separator in string argument can vary 8 features: [Temporal] 9 ---*/ 10 11 const epoch = new Temporal.ZonedDateTime(0n, "UTC"); 12 const tests = [ 13 ["1970-01-01T00:00+00:00[UTC]", "uppercase T"], 14 ["1970-01-01t00:00+00:00[UTC]", "lowercase T"], 15 ["1970-01-01 00:00+00:00[UTC]", "space between date and time"], 16 ]; 17 18 tests.forEach(([arg, description]) => { 19 assert.sameValue( 20 Temporal.ZonedDateTime.compare(arg, epoch), 21 0, 22 `variant time separators (${description}), first argument` 23 ); 24 25 assert.sameValue( 26 Temporal.ZonedDateTime.compare(epoch, arg), 27 0, 28 `variant time separators (${description}), second argument` 29 ); 30 }); 31 32 reportCompare(0, 0);