Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainYearMonth/calendar-always.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
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.plainyearmonth
7 description: If calendar name is to be emitted, include additional reference info
8 features: [Temporal]
9 ---*/
10
11 const pym = new Temporal.PlainYearMonth(2019, 10, "iso8601", 31);
12
13 assert.sameValue(
14 pym.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 anotherPYM = Temporal.PlainYearMonth.from("2019-10-31"); // 31 will get dropped
20
21 assert.sameValue(
22 anotherPYM.toString({ calendarName: 'always' }),
23 "2019-10-01[u-ca=iso8601]",
24 "emit fallback day if calendarName = 'always' (static from)"
25 );
26
27 reportCompare(0, 0);