fields-underspecified.js (957B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2023 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.plainmonthday.from 7 description: Throw a RangeError if only one of era/eraYear fields is present 8 features: [Temporal] 9 ---*/ 10 11 const tests = [ 12 ["gregory", { year: 2000, month: 5, day: 2, era: "ce" }, "era present but not eraYear"], 13 ["gregory", { year: 2000, month: 5, day: 2, eraYear: 1 }, "eraYear present but not era"], 14 ["gregory", { month: 8, day: 1 }, "no monthCode or year specification, non-ISO Gregorian"], 15 ["hebrew", { month: 8, day: 1 }, "no monthCode or year specification, non-ISO non-Gregorian"], 16 ]; 17 18 for (const [calendarId, arg, description] of tests) { 19 assert.throws(TypeError, () => Temporal.PlainMonthDay.from({ ...arg, calendar: calendarId }), description); 20 } 21 22 reportCompare(0, 0);