// Year, month, and day
const d1 = Temporal.PlainDate.from({ year: 2021, month: 7, day: 1 });
console.log(d1.toString()); // "2021-07-01"
// Year, month code, and day
const d2 = Temporal.PlainDate.from({ year: 2021, monthCode: "M07", day: 1 });
console.log(d2.toString()); // "2021-07-01"
// Year, month, day in a different calendar
const d3 = Temporal.PlainDate.from({
year: 2021,
month: 7,
day: 1,
calendar: "chinese",
});
// Note: when you construct a date with an object, the date components
// are in *that* calendar, not the ISO calendar. However, toString() always
// outputs the date in the ISO calendar. For example, the year "2021" in
// the Chinese calendar is actually 616 BC in the ISO calendar.
console.log(d3.toString()); // "-000616-08-12[u-ca=chinese]"
// Era, eraYear, month, and day
const d4 = Temporal.PlainDate.from({
era: "meiji",
eraYear: 4,
month: 7,
day: 1,
calendar: "japanese",
});
console.log(d4.toString()); // "1871-07-01[u-ca=japanese]"