canonicalize-era-codes.js (916B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2024 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.plaindate.from 7 description: Calendar era code is canonicalized 8 includes: [temporalHelpers.js] 9 features: [Temporal, Intl.Era-monthcode] 10 ---*/ 11 12 const date1 = Temporal.PlainDate.from({ 13 calendar: "gregory", 14 era: "ad", 15 eraYear: 2024, 16 year: 2024, 17 month: 1, 18 day: 1 19 }); 20 TemporalHelpers.assertPlainDate( 21 date1, 22 2024, 1, "M01", 1, 23 "'ad' is accepted as alias for 'ce'", 24 "ce", 2024 25 ); 26 27 const date2 = Temporal.PlainDate.from({ 28 calendar: "gregory", 29 era: "bc", 30 eraYear: 44, 31 year: -43, 32 month: 3, 33 day: 15 34 }); 35 TemporalHelpers.assertPlainDate( 36 date2, 37 -43, 3, "M03", 15, 38 "'bc' is accepted as alias for 'bce'", 39 "bce", 44 40 ); 41 42 reportCompare(0, 0);