argument-string.js (1307B)
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.plainyearmonth.from 7 description: A string is parsed into the correct object when passed as the argument 8 includes: [temporalHelpers.js] 9 features: [Temporal] 10 ---*/ 11 12 for (const input of TemporalHelpers.ISO.plainYearMonthStringsValid()) { 13 const plainYearMonth = Temporal.PlainYearMonth.from(input); 14 TemporalHelpers.assertPlainYearMonth(plainYearMonth, 1976, 11, "M11"); 15 assert.sameValue(plainYearMonth.calendarId, "iso8601", "calendar string should be iso8601"); 16 assert.sameValue(plainYearMonth.toString({ calendarName: "always" }), "1976-11-01[u-ca=iso8601]", "iso reference date"); 17 } 18 19 for (const input of TemporalHelpers.ISO.plainYearMonthStringsValidNegativeYear()) { 20 const plainYearMonth = Temporal.PlainYearMonth.from(input); 21 TemporalHelpers.assertPlainYearMonth(plainYearMonth, -9999, 11, "M11"); 22 assert.sameValue(plainYearMonth.calendarId, "iso8601", "calendar string should be iso8601"); 23 assert.sameValue(plainYearMonth.toString({ calendarName: "always" }), "-009999-11-01[u-ca=iso8601]", "iso reference date"); 24 } 25 26 reportCompare(0, 0);