non-positive-single-era-year.js (962B)
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: Non-positive era years in calendars with a single era 8 includes: [temporalHelpers.js] 9 features: [Temporal, Intl.Era-monthcode] 10 ---*/ 11 12 const calendarEras = { 13 buddhist: "be", 14 coptic: "am", 15 ethioaa: "aa", 16 hebrew: "am", 17 indian: "shaka", 18 persian: "ap", 19 }; 20 const options = { overflow: "reject" }; 21 22 for (const [calendar, era] of Object.entries(calendarEras)) { 23 for (const eraYear of [-1, 0, 1]) { 24 const date = Temporal.PlainYearMonth.from({ era, eraYear, monthCode: "M01", calendar }, options); 25 TemporalHelpers.assertPlainYearMonth( 26 date, 27 eraYear, 1, "M01", `era year ${eraYear} is not remapped`, 28 era, eraYear, null); 29 } 30 } 31 32 reportCompare(0, 0);