summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainMonthDay/calendar-always.js
blob: 727a72bfe58808abfc0af825b9404e56a6c70929 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plainmonthday
description: If calendar name is to be emitted, include additional reference info
features: [Temporal]
---*/

const pmd = new Temporal.PlainMonthDay(10, 31, "iso8601", 2019);

assert.sameValue(
  pmd.toString({ calendarName: 'always' }),
  "2019-10-31[u-ca=iso8601]",
  "emit year-month-day if calendarName = 'always' (four-argument constructor)"
);

const anotherPMD = Temporal.PlainMonthDay.from("2019-10-31"); // 2019 will get dropped

assert.sameValue(
  anotherPMD.toString({ calendarName: 'always' }),
  "1972-10-31[u-ca=iso8601]",
  "emit fallback year if calendarName = 'always' (static from)"
);

reportCompare(0, 0);