argument-propertybag-calendar-case-insensitive.js (1177B)
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: The calendar name is case-insensitive 8 features: [Temporal] 9 ---*/ 10 11 const timeZone = "UTC"; 12 const datetime = new Temporal.ZonedDateTime(0n, timeZone); 13 14 const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: "IsO8601" }; 15 const result1 = Temporal.ZonedDateTime.compare(arg, datetime); 16 assert.sameValue(result1, 0, "Calendar is case-insensitive (first argument)"); 17 const result2 = Temporal.ZonedDateTime.compare(datetime, arg); 18 assert.sameValue(result2, 0, "Calendar is case-insensitive (second argument)"); 19 20 arg.calendar = "\u0130SO8601"; 21 assert.throws( 22 RangeError, 23 () => Temporal.ZonedDateTime.compare(arg, datetime), 24 "calendar ID is capital dotted I is not lowercased (first argument)" 25 ); 26 assert.throws( 27 RangeError, 28 () => Temporal.ZonedDateTime.compare(datetime, arg), 29 "calendar ID is capital dotted I is not lowercased (second argument)" 30 ); 31 32 reportCompare(0, 0);