Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The with()
method of Temporal.PlainMonthDay
instances returns a new Temporal.PlainMonthDay
object representing this month-day with some fields replaced by new values. Because all Temporal
objects are designed to be immutable, this method essentially functions as the setter for the month-day's fields.
There's no obvious way to create a new Temporal.PlainMonthDay
object that represents the same month-day in a different calendar, so to replace its calendarId
property, you need to convert it to a Temporal.PlainDate
object using toPlainDate()
, change the calendar, and then convert it back.