argument-object-month.js (1026B)
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.plaindatetime.from 7 description: A plain object argument needs to specify a month 8 features: [Temporal] 9 ---*/ 10 11 assert.throws( 12 RangeError, 13 () => Temporal.PlainDateTime.from({year: 1976, month: 11, monthCode: "M12", day: 18}), 14 "month and monthCode must agree" 15 ); 16 17 assert.throws( 18 TypeError, 19 () => Temporal.PlainDateTime.from({year: 1976, month: undefined, monthCode: undefined, day: 18}), 20 "required prop undefined throws" 21 ); 22 23 assert.throws( 24 TypeError, 25 () => Temporal.PlainDateTime.from({year: 1976, day: 18, hour: 15, minute: 23, second: 30, millisecond: 123}), 26 "required prop missing throws" 27 ); 28 29 assert.throws( 30 TypeError, 31 () => Temporal.PlainDateTime.from({year: 1976, months: 11, day: 18}), 32 "plural \"months\" is not acceptable" 33 ); 34 35 reportCompare(0, 0);