invalid-month-codes-hebrew.js (862B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2025 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: Month codes that are invalid for Hebrew calendar 8 features: [Temporal, Intl.Era-monthcode] 9 ---*/ 10 11 const calendar = "hebrew"; 12 13 assert.throws(RangeError, () => { 14 Temporal.PlainYearMonth.from({ year: 5779, monthCode: "M13", calendar }); 15 }, "M13 should not be a valid month code"); 16 17 // Invalid leap months: e.g. M02L 18 for (var i = 1; i <= 12; i++) { 19 if (i === 5) 20 continue; 21 const monthCode = `M${ i.toString().padStart(2, "0") }L`; 22 assert.throws(RangeError, function () { 23 Temporal.PlainYearMonth.from({ year: 5779, monthCode, calendar }); 24 }); 25 } 26 27 reportCompare(0, 0);