Temporal.PlainDate Objects

A Temporal.PlainDate object is an Object that contains integers corresponding to a particular year, month, and day in the ISO8601 calendar, as well as an Object value used to interpret those integers in a particular calendar.

The Temporal.PlainDate Constructor

The Temporal.PlainDate constructor:

Temporal.PlainDate ( _isoYear_, _isoMonth_, _isoDay_ [ , _calendar_ ] )

This function performs the following steps when called:

1. If NewTarget is *undefined*, throw a *TypeError* exception. 1. Let _y_ be ? ToIntegerWithTruncation(_isoYear_). 1. Let _m_ be ? ToIntegerWithTruncation(_isoMonth_). 1. Let _d_ be ? ToIntegerWithTruncation(_isoDay_). 1. If _calendar_ is *undefined*, set _calendar_ to *"iso8601"*. 1. If _calendar_ is not a String, throw a *TypeError* exception. 1. Set _calendar_ to ? CanonicalizeCalendar(_calendar_). 1. If IsValidISODate(_y_, _m_, _d_) is *false*, throw a *RangeError* exception. 1. Let _isoDate_ be CreateISODateRecord(_y_, _m_, _d_). 1. Return ? CreateTemporalDate(_isoDate_, _calendar_, NewTarget).

Properties of the Temporal.PlainDate Constructor

The Temporal.PlainDate constructor:

Temporal.PlainDate.prototype

The initial value of `Temporal.PlainDate.prototype` is %Temporal.PlainDate.prototype%.

This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

Temporal.PlainDate.from ( _item_ [ , _options_ ] )

This function performs the following steps when called:

1. Return ? ToTemporalDate(_item_, _options_).

Temporal.PlainDate.compare ( _one_, _two_ )

This function performs the following steps when called:

1. Set _one_ to ? ToTemporalDate(_one_). 1. Set _two_ to ? ToTemporalDate(_two_). 1. Return 𝔽(CompareISODate(_one_.[[ISODate]], _two_.[[ISODate]])).

Properties of the Temporal.PlainDate Prototype Object

The Temporal.PlainDate prototype object

An ECMAScript implementation that includes the ECMA-402 Internationalization API extends this prototype with additional properties in order to represent calendar data.

Temporal.PlainDate.prototype.constructor

The initial value of `Temporal.PlainDate.prototype.constructor` is %Temporal.PlainDate%.

Temporal.PlainDate.prototype[ %Symbol.toStringTag% ]

The initial value of the %Symbol.toStringTag% property is the String value *"Temporal.PlainDate"*.

This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

get Temporal.PlainDate.prototype.calendarId

`Temporal.PlainDate.prototype.calendarId` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return _temporalDate_.[[Calendar]].

get Temporal.PlainDate.prototype.era

`Temporal.PlainDate.prototype.era` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _plainDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_plainDate_, [[InitializedTemporalDate]]). 1. Return CalendarISOToDate(_plainDate_.[[Calendar]], _plainDate_.[[ISODate]]).[[Era]].

get Temporal.PlainDate.prototype.eraYear

`Temporal.PlainDate.prototype.eraYear` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _plainDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_plainDate_, [[InitializedTemporalDate]]). 1. Let _result_ be CalendarISOToDate(_plainDate_.[[Calendar]], _plainDate_.[[ISODate]]).[[EraYear]]. 1. If _result_ is *undefined*, return *undefined*. 1. Return 𝔽(_result_).

get Temporal.PlainDate.prototype.year

`Temporal.PlainDate.prototype.year` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[Year]]).

get Temporal.PlainDate.prototype.month

`Temporal.PlainDate.prototype.month` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[Month]]).

get Temporal.PlainDate.prototype.monthCode

`Temporal.PlainDate.prototype.monthCode` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[MonthCode]].

get Temporal.PlainDate.prototype.day

`Temporal.PlainDate.prototype.day` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[Day]]).

get Temporal.PlainDate.prototype.dayOfWeek

`Temporal.PlainDate.prototype.dayOfWeek` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[DayOfWeek]]).

get Temporal.PlainDate.prototype.dayOfYear

`Temporal.PlainDate.prototype.dayOfYear` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[DayOfYear]]).

get Temporal.PlainDate.prototype.weekOfYear

`Temporal.PlainDate.prototype.weekOfYear` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _result_ be CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[WeekOfYear]].[[Week]]. 1. If _result_ is *undefined*, return *undefined*. 1. Return 𝔽(_result_).

get Temporal.PlainDate.prototype.yearOfWeek

`Temporal.PlainDate.prototype.yearOfWeek` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _result_ be CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[WeekOfYear]].[[Year]]. 1. If _result_ is *undefined*, return *undefined*. 1. Return 𝔽(_result_).

get Temporal.PlainDate.prototype.daysInWeek

`Temporal.PlainDate.prototype.daysInWeek` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[DaysInWeek]]).

get Temporal.PlainDate.prototype.daysInMonth

`Temporal.PlainDate.prototype.daysInMonth` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[DaysInMonth]]).

get Temporal.PlainDate.prototype.daysInYear

`Temporal.PlainDate.prototype.daysInYear` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[DaysInYear]]).

get Temporal.PlainDate.prototype.monthsInYear

`Temporal.PlainDate.prototype.monthsInYear` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return 𝔽(CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[MonthsInYear]]).

get Temporal.PlainDate.prototype.inLeapYear

`Temporal.PlainDate.prototype.inLeapYear` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return CalendarISOToDate(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]]).[[InLeapYear]].

Temporal.PlainDate.prototype.toPlainYearMonth ( )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _calendar_ be _temporalDate_.[[Calendar]]. 1. Let _fields_ be ISODateToFields(_calendar_, _temporalDate_.[[ISODate]], ~date~). 1. Let _isoDate_ be ? CalendarYearMonthFromFields(_calendar_, _fields_, ~constrain~). 1. Return ! CreateTemporalYearMonth(_isoDate_, _calendar_). 1. NOTE: The call to CalendarYearMonthFromFields is necessary in order to create a PlainYearMonth object with the [[Day]] field of the [[ISODate]] internal slot set correctly.

Temporal.PlainDate.prototype.toPlainMonthDay ( )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _calendar_ be _temporalDate_.[[Calendar]]. 1. Let _fields_ be ISODateToFields(_calendar_, _temporalDate_.[[ISODate]], ~date~). 1. Let _isoDate_ be ? CalendarMonthDayFromFields(_calendar_, _fields_, ~constrain~). 1. Return ! CreateTemporalMonthDay(_isoDate_, _calendar_). 1. NOTE: The call to CalendarMonthDayFromFields is necessary in order to create a PlainMonthDay object with the [[Year]] field of the [[ISODate]] internal slot set correctly.

Temporal.PlainDate.prototype.add ( _temporalDurationLike_ [ , _options_ ] )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return ? AddDurationToDate(~add~, _temporalDate_, _temporalDurationLike_, _options_).

Temporal.PlainDate.prototype.subtract ( _temporalDurationLike_ [ , _options_ ] )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return ? AddDurationToDate(~subtract~, _temporalDate_, _temporalDurationLike_, _options_).

Temporal.PlainDate.prototype.with ( _temporalDateLike_ [ , _options_ ] )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. If ? IsPartialTemporalObject(_temporalDateLike_) is *false*, throw a *TypeError* exception. 1. Let _calendar_ be _temporalDate_.[[Calendar]]. 1. Let _fields_ be ISODateToFields(_calendar_, _temporalDate_.[[ISODate]], ~date~). 1. Let _partialDate_ be ? PrepareCalendarFields(_calendar_, _temporalDateLike_, « ~year~, ~month~, ~month-code~, ~day~ », « », ~partial~). 1. Set _fields_ to CalendarMergeFields(_calendar_, _fields_, _partialDate_). 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Let _overflow_ be ? GetTemporalOverflowOption(_resolvedOptions_). 1. Let _isoDate_ be ? CalendarDateFromFields(_calendar_, _fields_, _overflow_). 1. Return ! CreateTemporalDate(_isoDate_, _calendar_).

Temporal.PlainDate.prototype.withCalendar ( _calendarLike_ )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _calendar_ be ? ToTemporalCalendarIdentifier(_calendarLike_). 1. Return ! CreateTemporalDate(_temporalDate_.[[ISODate]], _calendar_).

Temporal.PlainDate.prototype.until ( _other_ [ , _options_ ] )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return ? DifferenceTemporalPlainDate(~until~, _temporalDate_, _other_, _options_).

Temporal.PlainDate.prototype.since ( _other_ [ , _options_ ] )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return ? DifferenceTemporalPlainDate(~since~, _temporalDate_, _other_, _options_).

Temporal.PlainDate.prototype.equals ( _other_ )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Set _other_ to ? ToTemporalDate(_other_). 1. If CompareISODate(_temporalDate_.[[ISODate]], _other_.[[ISODate]]) ≠ 0, return *false*. 1. Return CalendarEquals(_temporalDate_.[[Calendar]], _other_.[[Calendar]]).

Temporal.PlainDate.prototype.toPlainDateTime ( [ _temporalTime_ ] )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _time_ be ? ToTimeRecordOrMidnight(_temporalTime_). 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_temporalDate_.[[ISODate]], _time_). 1. Return ? CreateTemporalDateTime(_isoDateTime_, _temporalDate_.[[Calendar]]).

Temporal.PlainDate.prototype.toZonedDateTime ( _item_ )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. If _item_ is an Object, then 1. Let _timeZoneLike_ be ? Get(_item_, *"timeZone"*). 1. If _timeZoneLike_ is *undefined*, then 1. Let _timeZone_ be ? ToTemporalTimeZoneIdentifier(_item_). 1. Let _temporalTime_ be *undefined*. 1. Else, 1. Let _timeZone_ be ? ToTemporalTimeZoneIdentifier(_timeZoneLike_). 1. Let _temporalTime_ be ? Get(_item_, *"plainTime"*). 1. Else, 1. Let _timeZone_ be ? ToTemporalTimeZoneIdentifier(_item_). 1. Let _temporalTime_ be *undefined*. 1. If _temporalTime_ is *undefined*, then 1. Let _epochNs_ be ? GetStartOfDay(_timeZone_, _temporalDate_.[[ISODate]]). 1. Else, 1. Set _temporalTime_ to ? ToTemporalTime(_temporalTime_). 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_temporalDate_.[[ISODate]], _temporalTime_.[[Time]]). 1. If ISODateTimeWithinLimits(_isoDateTime_) is *false*, throw a *RangeError* exception. 1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _isoDateTime_, ~compatible~). 1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _temporalDate_.[[Calendar]]).

Temporal.PlainDate.prototype.toString ( [ _options_ ] )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Let _showCalendar_ be ? GetTemporalShowCalendarNameOption(_resolvedOptions_). 1. Return TemporalDateToString(_temporalDate_, _showCalendar_).

Temporal.PlainDate.prototype.toLocaleString ( [ _locales_ [ , _options_ ] ] )

An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used.

The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return TemporalDateToString(_temporalDate_, ~auto~).

Temporal.PlainDate.prototype.toJSON ( )

This method performs the following steps when called:

1. Let _temporalDate_ be the *this* value. 1. Perform ? RequireInternalSlot(_temporalDate_, [[InitializedTemporalDate]]). 1. Return TemporalDateToString(_temporalDate_, ~auto~).

Temporal.PlainDate.prototype.valueOf ( )

This method performs the following steps when called:

1. Throw a *TypeError* exception.

This method always throws, because in the absence of `valueOf()`, expressions with arithmetic operators such as `plainDate1 > plainDate2` would fall back to being equivalent to `plainDate1.toString() > plainDate2.toString()`. Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct. Implementations are encouraged to phrase the error message to point users to `Temporal.PlainDate.compare()`, `Temporal.PlainDate.prototype.equals()`, and/or `Temporal.PlainDate.prototype.toString()`.

Properties of Temporal.PlainDate Instances

Temporal.PlainDate instances are ordinary objects that inherit properties from the %Temporal.PlainDate.prototype% intrinsic object. Temporal.PlainDate instances are initially created with the internal slots described in .

Internal Slot Description
[[InitializedTemporalDate]] The only specified use of this slot is for distinguishing Temporal.PlainDate instances from other objects.
[[ISODate]] An ISO Date Record.
[[Calendar]] A calendar type.

Abstract Operations for Temporal.PlainDate Objects

ISO Date Records

An ISO Date Record is a Record value used to represent a valid calendar date in the ISO 8601 calendar, although the year may be outside of the allowed range for Temporal. ISO Date Records are produced by the abstract operation CreateISODateRecord.

ISO Date Records have the fields listed in .

Field Name Value Meaning
[[Year]] an integer The year in the ISO 8601 calendar.
[[Month]] an integer between 1 and 12, inclusive The number of the month in the ISO 8601 calendar.
[[Day]] an integer between 1 and 31, inclusive The number of the day of the month in the ISO 8601 calendar.

CreateISODateRecord ( _year_: an integer, _month_: an integer between 1 and 12 inclusive, _day_: an integer between 1 and 31 inclusive, ): an ISO Date Record

description
1. Assert: IsValidISODate(_year_, _month_, _day_) is *true*. 1. Return ISO Date Record { [[Year]]: _year_, [[Month]]: _month_, [[Day]]: _day_ }.

CreateTemporalDate ( _isoDate_: an ISO Date Record, _calendar_: a calendar type, optional _newTarget_: a constructor, ): either a normal completion containing a Temporal.PlainDate or a throw completion

description
It creates a Temporal.PlainDate instance and fills the internal slots with valid values.
1. If ISODateWithinLimits(_isoDate_) is *false*, throw a *RangeError* exception. 1. If _newTarget_ is not present, set _newTarget_ to %Temporal.PlainDate%. 1. Let _object_ be ? OrdinaryCreateFromConstructor(_newTarget_, *"%Temporal.PlainDate.prototype%"*, « [[InitializedTemporalDate]], [[ISODate]], [[Calendar]] »). 1. Set _object_.[[ISODate]] to _isoDate_. 1. Set _object_.[[Calendar]] to _calendar_. 1. Return _object_.

ToTemporalDate ( _item_: an ECMAScript language value, optional _options_: an ECMAScript language value, ): either a normal completion containing a Temporal.PlainDate or a throw completion

description
Converts _item_ to a new Temporal.PlainDate instance if possible, and throws otherwise.
1. If _options_ is not present, set _options_ to *undefined*. 1. If _item_ is an Object, then 1. If _item_ has an [[InitializedTemporalDate]] internal slot, then 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Perform ? GetTemporalOverflowOption(_resolvedOptions_). 1. Return ! CreateTemporalDate(_item_.[[ISODate]], _item_.[[Calendar]]). 1. If _item_ has an [[InitializedTemporalZonedDateTime]] internal slot, then 1. Let _isoDateTime_ be GetISODateTimeFor(_item_.[[TimeZone]], _item_.[[EpochNanoseconds]]). 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Perform ? GetTemporalOverflowOption(_resolvedOptions_). 1. Return ! CreateTemporalDate(_isoDateTime_.[[ISODate]], _item_.[[Calendar]]). 1. If _item_ has an [[InitializedTemporalDateTime]] internal slot, then 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Perform ? GetTemporalOverflowOption(_resolvedOptions_). 1. Return ! CreateTemporalDate(_item_.[[ISODateTime]].[[ISODate]], _item_.[[Calendar]]). 1. Let _calendar_ be ? GetTemporalCalendarIdentifierWithISODefault(_item_). 1. Let _fields_ be ? PrepareCalendarFields(_calendar_, _item_, « ~year~, ~month~, ~month-code~, ~day~ », «», «»). 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Let _overflow_ be ? GetTemporalOverflowOption(_resolvedOptions_). 1. Let _isoDate_ be ? CalendarDateFromFields(_calendar_, _fields_, _overflow_). 1. Return ! CreateTemporalDate(_isoDate_, _calendar_). 1. If _item_ is not a String, throw a *TypeError* exception. 1. Let _result_ be ? ParseISODateTime(_item_, « |TemporalDateTimeString[~Zoned]| »). 1. Let _calendar_ be _result_.[[Calendar]]. 1. If _calendar_ is ~empty~, set _calendar_ to *"iso8601"*. 1. Set _calendar_ to ? CanonicalizeCalendar(_calendar_). 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Perform ? GetTemporalOverflowOption(_resolvedOptions_). 1. Let _isoDate_ be CreateISODateRecord(_result_.[[Year]], _result_.[[Month]], _result_.[[Day]]). 1. Return ? CreateTemporalDate(_isoDate_, _calendar_).

ISODateSurpasses ( _sign_: -1 or 1, _y1_: an integer, _m1_: an integer, _d1_: an integer, _isoDate2_: an ISO Date Record, ): a Boolean

description
The return value indicates whether the date denoted by _y1_, _m1_, _d1_ surpasses that denoted by _isoDate2_ in the direction denoted by _sign_. The former date does not have to exist. Note that this operation is specific to date difference calculations and is not the same as CompareISODate.
1. If _y1_ ≠ _isoDate2_.[[Year]], then 1. If _sign_ × (_y1_ - _isoDate2_.[[Year]]) > 0, return *true*. 1. Else if _m1_ ≠ _isoDate2_.[[Month]], then 1. If _sign_ × (_m1_ - _isoDate2_.[[Month]]) > 0, return *true*. 1. Else if _d1_ ≠ _isoDate2_.[[Day]], then 1. If _sign_ × (_d1_ - _isoDate2_.[[Day]]) > 0, return *true*. 1. Return *false*.

RegulateISODate ( _year_: an integer, _month_: an integer, _day_: an integer, _overflow_: ~constrain~ or ~reject~, ): either a normal completion containing an ISO Date Record or a throw completion

description
It performs the overflow correction specified by _overflow_ on the values _year_, _month_, and _day_, in order to arrive at a valid date in the ISO 8601 calendar, as determined by IsValidISODate. For ~reject~, values that do not form a valid date cause an exception to be thrown. For ~constrain~, values that do not form a valid date are independently clamped to their respective valid range in order of descending unit magnitude.
1. If _overflow_ is ~constrain~, then 1. Set _month_ to the result of clamping _month_ between 1 and 12. 1. Let _daysInMonth_ be ISODaysInMonth(_year_, _month_). 1. Set _day_ to the result of clamping _day_ between 1 and _daysInMonth_. 1. Else, 1. Assert: _overflow_ is ~reject~. 1. If IsValidISODate(_year_, _month_, _day_) is *false*, throw a *RangeError* exception. 1. Return CreateISODateRecord(_year_, _month_, _day_).

IsValidISODate ( _year_: an integer, _month_: an integer, _day_: an integer, ): a Boolean

description
The return value is *true* if its arguments form a valid date in the ISO 8601 calendar, and *false* otherwise. This includes dates that may fall outside of the allowed range for Temporal.
1. If _month_ < 1 or _month_ > 12, then 1. Return *false*. 1. Let _daysInMonth_ be ISODaysInMonth(_year_, _month_). 1. If _day_ < 1 or _day_ > _daysInMonth_, then 1. Return *false*. 1. Return *true*.

BalanceISODate ( _year_: an integer, _month_: an integer, _day_: an integer, ): an ISO Date Record

description
It converts the given _year_, _month_, and _day_ into a valid calendar date in the ISO 8601 calendar as given by IsValidISODate, by overflowing out-of-range _month_ or _day_ values into the next-highest unit. This date may be outside the range given by ISODateTimeWithinLimits.
1. Let _epochDays_ be ISODateToEpochDays(_year_, _month_ - 1, _day_). 1. Let _ms_ be EpochDaysToEpochMs(_epochDays_, 0). 1. Return CreateISODateRecord(EpochTimeToEpochYear(_ms_), EpochTimeToMonthInYear(_ms_) + 1, EpochTimeToDate(_ms_)).

PadISOYear ( _y_: an integer, ): a String

description
It returns a String representation of _y_ suitable for inclusion in an ISO 8601 string, either in 4-digit format or 6-digit format with sign.
1. If _y_ ≥ 0 and _y_ ≤ 9999, then 1. Return ToZeroPaddedDecimalString(_y_, 4). 1. If _y_ > 0, let _yearSign_ be *"+"*; otherwise, let _yearSign_ be *"-"*. 1. Let _year_ be ToZeroPaddedDecimalString(abs(_y_), 6). 1. Return the string-concatenation of _yearSign_ and _year_.

TemporalDateToString ( _temporalDate_: a Temporal.PlainDate, _showCalendar_: ~auto~, ~always~, ~never~, or ~critical~, ): a String

description
It formats _temporalDate_ to an RFC 9557 string.
1. Let _year_ be PadISOYear(_temporalDate_.[[ISODate]].[[Year]]). 1. Let _month_ be ToZeroPaddedDecimalString(_temporalDate_.[[ISODate]].[[Month]], 2). 1. Let _day_ be ToZeroPaddedDecimalString(_temporalDate_.[[ISODate]].[[Day]], 2). 1. Let _calendar_ be FormatCalendarAnnotation(_temporalDate_.[[Calendar]], _showCalendar_). 1. Return the string-concatenation of _year_, the code unit 0x002D (HYPHEN-MINUS), _month_, the code unit 0x002D (HYPHEN-MINUS), _day_, and _calendar_.

ISODateWithinLimits ( _isoDate_: an ISO Date Record, ): a Boolean

description
The return value is *true* if the date in the ISO 8601 calendar given by the argument is within the representable range of `Temporal.PlainDate`, and *false* otherwise.

Deferring to ISODateTimeWithinLimits with an hour of 12 avoids trouble at the extremes of the representable range of Temporal.PlainDateTime, which stops just before midnight on each end.

1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_isoDate_, NoonTimeRecord()). 1. Return ISODateTimeWithinLimits(_isoDateTime_).

CompareISODate ( _isoDate1_: an ISO Date Record, _isoDate2_: an ISO Date Record, ): -1, 0, or 1

description
It performs a comparison of the two dates denoted by _isoDate1_ and _isoDate2_ according to ISO 8601 calendar arithmetic.
1. If _isoDate1_.[[Year]] > _isoDate2_.[[Year]], return 1. 1. If _isoDate1_.[[Year]] < _isoDate2_.[[Year]], return -1. 1. If _isoDate1_.[[Month]] > _isoDate2_.[[Month]], return 1. 1. If _isoDate1_.[[Month]] < _isoDate2_.[[Month]], return -1. 1. If _isoDate1_.[[Day]] > _isoDate2_.[[Day]], return 1. 1. If _isoDate1_.[[Day]] < _isoDate2_.[[Day]], return -1. 1. Return 0.

DifferenceTemporalPlainDate ( _operation_: ~since~ or ~until~, _temporalDate_: a Temporal.PlainDate, _other_: an ECMAScript language value, _options_: an ECMAScript language value, ): either a normal completion containing a Temporal.Duration or a throw completion

description
It computes the difference between the two times represented by _temporalDate_ and _other_, optionally rounds it, and returns it as a Temporal.Duration object.
1. Set _other_ to ? ToTemporalDate(_other_). 1. If CalendarEquals(_temporalDate_.[[Calendar]], _other_.[[Calendar]]) is *false*, throw a *RangeError* exception. 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Let _settings_ be ? GetDifferenceSettings(_operation_, _resolvedOptions_, ~date~, « », ~day~, ~day~). 1. If CompareISODate(_temporalDate_.[[ISODate]], _other_.[[ISODate]]) = 0, then 1. Return ! CreateTemporalDuration(0, 0, 0, 0, 0, 0, 0, 0, 0, 0). 1. Let _dateDifference_ be CalendarDateUntil(_temporalDate_.[[Calendar]], _temporalDate_.[[ISODate]], _other_.[[ISODate]], _settings_.[[LargestUnit]]). 1. Let _duration_ be CombineDateAndTimeDuration(_dateDifference_, 0). 1. If _settings_.[[SmallestUnit]] is not ~day~ or _settings_.[[RoundingIncrement]] ≠ 1, then 1. Let _isoDateTime_ be CombineISODateAndTimeRecord(_temporalDate_.[[ISODate]], MidnightTimeRecord()). 1. Let _isoDateTimeOther_ be CombineISODateAndTimeRecord(_other_.[[ISODate]], MidnightTimeRecord()). 1. Let _destEpochNs_ be GetUTCEpochNanoseconds(_isoDateTimeOther_). 1. Set _duration_ to ? RoundRelativeDuration(_duration_, _destEpochNs_, _isoDateTime_, ~unset~, _temporalDate_.[[Calendar]], _settings_.[[LargestUnit]], _settings_.[[RoundingIncrement]], _settings_.[[SmallestUnit]], _settings_.[[RoundingMode]]). 1. Let _result_ be ! TemporalDurationFromInternal(_duration_, ~day~). 1. If _operation_ is ~since~, set _result_ to CreateNegatedTemporalDuration(_result_). 1. Return _result_.

AddDurationToDate ( _operation_: ~add~ or ~subtract~, _temporalDate_: a Temporal.PlainDate, _temporalDurationLike_: an ECMAScript language value, _options_: an ECMAScript language value, ): either a normal completion containing a Temporal.PlainDate or a throw completion

description
It adds/subtracts _temporalDurationLike_ to/from _temporalDate_, returning a point in time that is in the future/past relative to _temporalDate_.
1. Let _calendar_ be _temporalDate_.[[Calendar]]. 1. Let _duration_ be ? ToTemporalDuration(_temporalDurationLike_). 1. If _operation_ is ~subtract~, set _duration_ to CreateNegatedTemporalDuration(_duration_). 1. Let _dateDuration_ be ToDateDurationRecordWithoutTime(_duration_). 1. Let _resolvedOptions_ be ? GetOptionsObject(_options_). 1. Let _overflow_ be ? GetTemporalOverflowOption(_resolvedOptions_). 1. Let _result_ be ? CalendarDateAdd(_calendar_, _temporalDate_.[[ISODate]], _dateDuration_, _overflow_). 1. Return ! CreateTemporalDate(_result_, _calendar_).