PlainMonthDay
objects can be serialized and parsed using the RFC 9557 format, an extension to the ISO 8601 / RFC 3339 format. The string has the following form (spaces are only for readability and should not be present in the actual string):
YYYY-MM-DD [u-ca=calendar_id]
YYYY
Optional -
Either a four-digit number, or a six-digit number with a +
or -
sign. It is required for non-ISO calendars, and optional otherwise. If omitted, you can either replace YYYY-
with --
(so the string looks like --MM-DD
or --MMDD
), or omit the YYYY-
part entirely (so the string looks like MM-DD
or MMDD
). Note that the reference year actually stored may be different from the one you provide, but the represented month-day is the same. See Temporal.PlainMonthDay.from()
for more information.
MM
-
A two-digit number from 01
to 12
.
DD
-
A two-digit number from 01
to 31
. The YYYY
, MM
, and DD
components can be separated by -
or nothing.
[u-ca=calendar_id]
Optional -
Replace calendar_id
with the calendar to use. May have a critical flag by prefixing the key with !
: e.g., [!u-ca=iso8601]
. This flag generally tells other systems that it cannot be ignored if they don't support it. The Temporal
parser will throw an error if the annotations contain two or more calendar annotations and one of them is critical. Defaults to [u-ca=iso8601]
. Note that the YYYY-MM-DD
is always interpreted as an ISO 8601 calendar date and then converted to the specified calendar.
As an input, you may optionally include the time, offset, and time zone identifier, in the same format as PlainDateTime
, but they will be ignored. Other annotations in the [key=value]
format are also ignored, and they must not have the critical flag.
When serializing, you can configure whether to display the calendar ID, and whether to add a critical flag for it.