calendar-always.js (892B)
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.plainmonthday 7 description: If calendar name is to be emitted, include additional reference info 8 features: [Temporal] 9 ---*/ 10 11 const pmd = new Temporal.PlainMonthDay(10, 31, "iso8601", 2019); 12 13 assert.sameValue( 14 pmd.toString({ calendarName: 'always' }), 15 "2019-10-31[u-ca=iso8601]", 16 "emit year-month-day if calendarName = 'always' (four-argument constructor)" 17 ); 18 19 const anotherPMD = Temporal.PlainMonthDay.from("2019-10-31"); // 2019 will get dropped 20 21 assert.sameValue( 22 anotherPMD.toString({ calendarName: 'always' }), 23 "1972-10-31[u-ca=iso8601]", 24 "emit fallback year if calendarName = 'always' (static from)" 25 ); 26 27 reportCompare(0, 0);