argument-string-with-time-designator.js (958B)
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.plaintime.compare 7 description: ISO 8601 time designator "T" allowed at the start of PlainTime strings 8 features: [Temporal, arrow-function] 9 ---*/ 10 11 const halfPast = new Temporal.PlainTime(0, 30); 12 const validStrings = [ 13 "T00:30", 14 "t00:30", 15 "T0030", 16 "t0030", 17 "T00:30:00", 18 "t00:30:00", 19 "T003000", 20 "t003000", 21 "T00:30:00.000000000", 22 "t00:30:00.000000000", 23 "T003000.000000000", 24 "t003000.000000000", 25 ]; 26 validStrings.forEach((arg) => { 27 assert.sameValue(Temporal.PlainTime.compare(arg, halfPast), 0, `T prefix is accepted: ${arg} (first argument)`); 28 assert.sameValue(Temporal.PlainTime.compare(halfPast, arg), 0, `T prefix is accepted: ${arg} (second argument)`); 29 }); 30 31 reportCompare(0, 0);