?
u
/
p
1-9
The venerable ECMAScript Date object has a number of challenges, including lack of immutability, lack of support for time zones, lack of support for use cases that require dates only or times only, a confusing and non-ergonomic API, and many other challenges.
The Temporal set of types addresses these challenges with a built-in date and time API for ECMAScript that includes:
This specification consists of three parts:
The Temporal object:
new
operator.The initial value of the
This property has the attributes { [[Writable]]:
See
See
See
See
See
See
See
See
See
The Temporal.Now object:
new
operator.The initial value of the
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
The
An implementation of HostSystemUTCEpochNanoseconds must conform to the following requirements:
This requirement is necessary if the system clock is set to a time outside the range that Temporal.Instant can represent. This is not expected to affect implementations in practice.
The default implementation of HostSystemUTCEpochNanoseconds performs the following steps when called:
ECMAScript
The abstract operation SystemUTCEpochMilliseconds takes no arguments and returns a Number. It performs the following steps when called:
The abstract operation SystemUTCEpochNanoseconds takes no arguments and returns a BigInt. It performs the following steps when called:
The abstract operation SystemDateTime takes argument temporalTimeZoneLike (an
A Temporal.PlainDate object
The Temporal.PlainDate
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The Temporal.PlainDate
The initial value of Temporal.PlainDate.prototype
is %Temporal.PlainDate.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.PlainDate prototype object
The initial value of Temporal.PlainDate.prototype.constructor
is %Temporal.PlainDate%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainDate.prototype.calendarId
is an
Temporal.PlainDate.prototype.era
is an
Temporal.PlainDate.prototype.eraYear
is an
Temporal.PlainDate.prototype.year
is an
Temporal.PlainDate.prototype.month
is an
Temporal.PlainDate.prototype.monthCode
is an
Temporal.PlainDate.prototype.day
is an
Temporal.PlainDate.prototype.dayOfWeek
is an
Temporal.PlainDate.prototype.dayOfYear
is an
Temporal.PlainDate.prototype.weekOfYear
is an
Temporal.PlainDate.prototype.yearOfWeek
is an
Temporal.PlainDate.prototype.daysInWeek
is an
Temporal.PlainDate.prototype.daysInMonth
is an
Temporal.PlainDate.prototype.daysInYear
is an
Temporal.PlainDate.prototype.monthsInYear
is an
Temporal.PlainDate.prototype.inLeapYear
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
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()
.
Temporal.PlainDate instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalDate]] | The only specified use of this slot is for distinguishing Temporal.PlainDate instances from other objects. |
[[ISODate]] |
An |
[[Calendar]] |
A |
An ISO Date Record is a
ISO Date Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Year]] | an |
The year in the ISO 8601 calendar. |
[[Month]] | an |
The number of the month in the ISO 8601 calendar. |
[[Day]] | an |
The number of the day of the month in the ISO 8601 calendar. |
The abstract operation CreateISODateRecord takes arguments year (an
The abstract operation CreateTemporalDate takes arguments isoDate (an
The abstract operation ToTemporalDate takes argument item (an
The abstract operation ISODateSurpasses takes arguments sign (-1 or 1), y1 (an
The abstract operation RegulateISODate takes arguments year (an
The abstract operation IsValidISODate takes arguments year (an
The abstract operation BalanceISODate takes arguments year (an
The abstract operation PadISOYear takes argument y (an
The abstract operation TemporalDateToString takes arguments temporalDate (a Temporal.PlainDate) and showCalendar (
The abstract operation ISODateWithinLimits takes argument isoDate (an Temporal.PlainDate
, and
Deferring to
It performs the following steps when called:
The abstract operation CompareISODate takes arguments isoDate1 (an
The abstract operation DifferenceTemporalPlainDate takes arguments operation (
The abstract operation AddDurationToDate takes arguments operation (
A Temporal.PlainTime object
The Temporal.PlainTime
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.PlainTime
The Temporal.PlainTime
The initial value of Temporal.PlainTime.prototype
is %Temporal.PlainTime.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.PlainTime prototype object
The initial value of Temporal.PlainTime.prototype.constructor
is %Temporal.PlainTime%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainTime.prototype.hour
is an
Temporal.PlainTime.prototype.minute
is an
Temporal.PlainTime.prototype.second
is an
Temporal.PlainTime.prototype.millisecond
is an
Temporal.PlainTime.prototype.microsecond
is an
Temporal.PlainTime.prototype.nanosecond
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
This method always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as plainTime1 > plainTime2
would fall back to being equivalent to plainTime1.toString() > plainTime2.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.PlainTime.compare()
, Temporal.PlainTime.prototype.equals()
, and/or Temporal.PlainTime.prototype.toString()
.
Temporal.PlainTime instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalTime]] | The only specified use of this slot is for distinguishing Temporal.PlainTime instances from other objects. |
[[Time]] |
A |
A Time Record is a
Time Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Days]] | an |
A number of overflow days. |
[[Hour]] | an |
The number of the hour. |
[[Minute]] | an |
The number of the minute. |
[[Second]] | an |
The number of the second. |
[[Millisecond]] | an |
The number of the millisecond. |
[[Microsecond]] | an |
The number of the microsecond. |
[[Nanosecond]] | an |
The number of the nanosecond. |
The abstract operation CreateTimeRecord takes arguments hour (an
The abstract operation MidnightTimeRecord takes no arguments and returns a
The abstract operation NoonTimeRecord takes no arguments and returns a
The abstract operation DifferenceTime takes arguments time1 (a
The abstract operation ToTemporalTime takes argument item (an
The abstract operation ToTimeRecordOrMidnight takes argument item (an
The abstract operation RegulateTime takes arguments hour (an
The abstract operation IsValidTime takes arguments hour (an
The abstract operation BalanceTime takes arguments hour (an
The abstract operation CreateTemporalTime takes argument time (a
The abstract operation ToTemporalTimeRecord takes argument temporalTimeLike (an Object) and optional argument completeness (
Field Name | Property Name |
---|---|
[[Hour]] | |
[[Minute]] | |
[[Second]] | |
[[Millisecond]] | |
[[Microsecond]] | |
[[Nanosecond]] |
The abstract operation TimeRecordToString takes arguments time (a
The abstract operation CompareTimeRecord takes arguments time1 (a
The abstract operation AddTime takes arguments time (a
The abstract operation RoundTime takes arguments time (a
The abstract operation DifferenceTemporalPlainTime takes arguments operation (
The abstract operation AddDurationToTime takes arguments operation (
A Temporal.PlainDateTime object
The Temporal.PlainDateTime
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.PlainDateTime
The Temporal.PlainDateTime
The initial value of Temporal.PlainDateTime.prototype
is
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.PlainDateTime prototype object
The initial value of Temporal.PlainDateTime.prototype.constructor
is %Temporal.PlainDateTime%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainDateTime.prototype.calendarId
is an
Temporal.PlainDate.prototype.era
is an
Temporal.PlainDateTime.prototype.eraYear
is an
Temporal.PlainDateTime.prototype.year
is an
Temporal.PlainDateTime.prototype.month
is an
Temporal.PlainDateTime.prototype.monthCode
is an
Temporal.PlainDateTime.prototype.day
is an
Temporal.PlainDateTime.prototype.hour
is an
Temporal.PlainDateTime.prototype.minute
is an
Temporal.PlainDateTime.prototype.second
is an
Temporal.PlainDateTime.prototype.millisecond
is an
Temporal.PlainDateTime.prototype.microsecond
is an
Temporal.PlainDateTime.prototype.nanosecond
is an
Temporal.PlainDateTime.prototype.dayOfWeek
is an
Temporal.PlainDateTime.prototype.dayOfYear
is an
Temporal.PlainDateTime.prototype.weekOfYear
is an
Temporal.PlainDateTime.prototype.yearOfWeek
is an
Temporal.PlainDateTime.prototype.daysInWeek
is an
Temporal.PlainDateTime.prototype.daysInMonth
is an
Temporal.PlainDateTime.prototype.daysInYear
is an
Temporal.PlainDateTime.prototype.monthsInYear
is an
Temporal.PlainDateTime.prototype.inLeapYear
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
This method always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as plainDateTime1 > plainDateTime2
would fall back to being equivalent to plainDateTime1.toString() > plainDateTime2.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.PlainDateTime.compare()
, Temporal.PlainDateTime.prototype.equals()
, and/or Temporal.PlainDateTime.prototype.toString()
.
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.PlainDateTime instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalDateTime]] | The only specified use of this slot is for distinguishing Temporal.PlainDateTime instances from other objects. |
[[ISODateTime]] |
An |
[[Calendar]] |
A |
An ISO Date-Time Record is a
ISO Date-Time Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[ISODate]] | an |
The date in the ISO 8601 calendar. |
[[Time]] | a |
The time. The [[Days]] field is ignored. |
The abstract operation TimeValueToISODateTimeRecord takes argument t (a
The abstract operation CombineISODateAndTimeRecord takes arguments isoDate (an
The abstract operation ISODateTimeWithinLimits takes argument isoDateTime (an Temporal.PlainDateTime
, and
Temporal.PlainDateTime objects can represent points in time within 24 hours (8.64 × 1013 nanoseconds) of the Temporal.Instant boundaries. This ensures that a Temporal.Instant object can be converted into a Temporal.PlainDateTime object using any time zone.
It performs the following steps when called:
The abstract operation InterpretTemporalDateTimeFields takes arguments calendar (a
The abstract operation ToTemporalDateTime takes argument item (an
The abstract operation BalanceISODateTime takes arguments year (an
The abstract operation CreateTemporalDateTime takes arguments isoDateTime (an
The abstract operation ISODateTimeToString takes arguments isoDateTime (an
The abstract operation CompareISODateTime takes arguments isoDateTime1 (an