era-boundary-ethiopic.js (1379B)
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 are remapped in ethiopic calendar 8 includes: [temporalHelpers.js] 9 features: [Temporal, Intl.Era-monthcode] 10 ---*/ 11 12 const calendar = "ethiopic"; 13 const options = { overflow: "reject" }; 14 15 const am0 = Temporal.PlainYearMonth.from({ era: "am", eraYear: 0, monthCode: "M01", calendar }, options); 16 TemporalHelpers.assertPlainYearMonth( 17 am0, 18 0, 1, "M01", "AM 0 resolves to AA 5500", 19 "aa", 5500, null); 20 21 const am1n = Temporal.PlainYearMonth.from({ era: "am", eraYear: -1, monthCode: "M01", calendar }, options); 22 TemporalHelpers.assertPlainYearMonth( 23 am1n, 24 -1, 1, "M01", "AM -1 resolves to AA 5499", 25 "aa", 5499, null); 26 27 const aa0 = Temporal.PlainYearMonth.from({ era: "aa", eraYear: 0, monthCode: "M01", calendar }, options); 28 TemporalHelpers.assertPlainYearMonth( 29 aa0, 30 -5500, 1, "M01", "AA 0 is not remapped", 31 "aa", 0, null); 32 33 const aa1n = Temporal.PlainYearMonth.from({ era: "aa", eraYear: -1, monthCode: "M01", calendar }, options); 34 TemporalHelpers.assertPlainYearMonth( 35 aa1n, 36 -5501, 1, "M01", "AA -1 is not remapped", 37 "aa", -1, null); 38 39 reportCompare(0, 0);