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:
First-class support for all time zones, including DST-safe arithmetic
Strongly-typed objects for dates, times, date/time values, year/month values, month/day values, "zoned" date/time values, and durations
Immutability for all Temporal objects
String serialization and interoperability via standardized formats
Compliance with industry standards like ISO 8601, RFC 3339, and RFC5545 (iCalendar)
Full support for non-Gregorian calendars
This specification consists of three parts:
The specification of the Temporal object and everything related to it, proposed to be added to ECMA-262 in new sections;
A list of amendments to be made to ECMA-262, other than the new sections above;
A list of amendments to be made to ECMA-402.
1 The Temporal Object
The Temporal object:
is the intrinsic object %Temporal%.
is the initial value of the "Temporal" property of the global object.
The host-defined abstract operation HostSystemUTCEpochNanoseconds takes argument global (a global object) and returns an integer.
It allows host environments to reduce the precision of the result.
In particular, web browsers artificially limit it to prevent abuse of security flaws
(e.g., Spectre) and to avoid certain methods of fingerprinting.
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:
Let ns be the approximate current UTC date and time, in nanoseconds since the epoch.
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.
creates and initializes a new Temporal.PlainDate object when called as a constructor.
is not intended to be called as a function and will throw an exception when called in that manner.
may be used as the value of an extends clause of a class definition.
Subclass constructors that intend to inherit the specified Temporal.PlainDate behaviour must
include a super call to the %Temporal.PlainDate% constructor to create and initialize subclass
instances with the necessary internal slots.
An ECMAScript implementation that includes the ECMA-402 Internationalization API extends this prototype with additional properties in order to represent calendar data.
3.3.1 Temporal.PlainDate.prototype.constructor
The initial value of Temporal.PlainDate.prototype.constructor is %Temporal.PlainDate%.
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 }.
3.3.3 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:
Temporal.PlainDate.prototype.era is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.eraYear is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.year is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.month is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.monthCode is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.day is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.dayOfWeek is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.dayOfYear is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
3.3.12 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:
3.3.13 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:
3.3.14 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:
3.3.15 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:
3.3.16 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:
3.3.17 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:
3.3.18 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:
Return ! CreateTemporalYearMonth(isoDate.[[Year]], isoDate.[[Month]], calendar, isoDate.[[Day]]).
NOTE: The call to CalendarYearMonthFromFields is necessary in order to create a PlainYearMonth object with the [[ISOYear]], [[ISOMonth]], and [[ISODay]] internal slots set correctly.
Return ! CreateTemporalMonthDay(isoDate.[[Month]], isoDate.[[Day]], calendar, isoDate.[[Year]]).
NOTE: The call to CalendarMonthDayFromFields is necessary in order to create a PlainMonthDay object with the [[ISOYear]], [[ISOMonth]], and [[ISODay]] internal slots set correctly.
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:
Throw a TypeError exception.
Note
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().
3.4 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 Table 1.
Table 1: Internal Slots of Temporal.PlainDate Instances
Internal Slot
Description
[[InitializedTemporalDate]]
The only specified use of this slot is for distinguishing Temporal.PlainDate instances from other objects.
[[ISOYear]]
An integer representing the year in the ISO 8601 calendar.
[[ISOMonth]]
An integer between 1 and 12, inclusive, representing the month of the year in the ISO 8601 calendar.
[[ISODay]]
An integer between 1 and ISODaysInMonth([[ISOYear]], [[ISOMonth]]), inclusive, representing the day of the month in the ISO 8601 calendar.
[[Calendar]]
A String representing the calendar.
3.5 Abstract Operations for Temporal.PlainDate Objects
3.5.1 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 Table 2.
The number of the day of the month in the ISO 8601 calendar.
3.5.2 CreateISODateRecord ( year, month, day )
The abstract operation CreateISODateRecord takes arguments year (an integer), month (an integer between 1 and 12 inclusive), and day (an integer between 1 and 31 inclusive) and returns an ISO Date Record. It performs the following steps when called:
The abstract operation TemporalObjectToISODateRecord takes argument temporalObject (a Temporal.PlainDate, Temporal.PlainDateTime, Temporal.PlainMonthDay, or Temporal.PlainYearMonth) and returns an ISO Date Record. It performs the following steps when called:
The abstract operation CreateTemporalDate takes arguments isoYear (an integer), isoMonth (an integer), isoDay (an integer), and calendar (a String or Object) and optional argument newTarget (a constructor) and returns either a normal completion containing a Temporal.PlainDate or a throw completion. It creates a Temporal.PlainDate instance and fills the internal slots with valid values. It performs the following steps when called:
If IsValidISODate(isoYear, isoMonth, isoDay) is false, throw a RangeError exception.
If ISODateWithinLimits(isoYear, isoMonth, isoDay) is false, throw a RangeError exception.
If newTarget is not present, set newTarget to %Temporal.PlainDate%.
Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.PlainDate.prototype%", « [[InitializedTemporalDate]], [[ISOYear]], [[ISOMonth]], [[ISODay]], [[Calendar]] »).
Set object.[[ISOYear]] to isoYear.
Set object.[[ISOMonth]] to isoMonth.
Set object.[[ISODay]] to isoDay.
Set object.[[Calendar]] to calendar.
Return object.
3.5.6 ToTemporalDate ( item [ , options ] )
The abstract operation ToTemporalDate takes argument item (an ECMAScript language value) and optional argument options (an ECMAScript language value) and returns either a normal completion containing a Temporal.PlainDate or a throw completion. It returns its argument item if it is already a Temporal.PlainDate instance, converts item to a new Temporal.PlainDate instance if possible, and throws otherwise. It performs the following steps when called:
If options is not present, set options to undefined.
The abstract operation ISODateSurpasses takes arguments sign (-1 or 1), y1 (an integer), m1 (an integer), d1 (an integer), y2 (an integer), m2 (an integer), and d2 (an integer) and returns a Boolean.
The return value indicates whether the date denoted by y1, m1, d1 surpasses that denoted by y2, m2, d2 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.
It performs the following steps when called:
The abstract operation DifferenceISODate takes arguments y1 (an integer), m1 (an integer), d1 (an integer), y2 (an integer), m2 (an integer), d2 (an integer), and largestUnit ("year", "month", "week", or "day") and returns a Date Duration Record.
The return value is the elapsed duration from a first date until a second date, according to the reckoning of the ISO 8601 calendar.
No fields larger than largestUnit will be non-zero in the resulting Date Duration Record.
It performs the following steps when called:
The abstract operation RegulateISODate takes arguments year (an integer), month (an integer), day (an integer), and overflow ("constrain" or "reject") and returns either a normal completion containing an ISO Date Record or a throw completion.
It performs the overflow correction given 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 clamped to the correct range.
It performs the following steps when called:
If overflow is "constrain", then
Set month to the result of clampingmonth between 1 and 12.
The abstract operation IsValidISODate takes arguments year (an integer), month (an integer), and day (an integer) and returns a Boolean.
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.
It performs the following steps when called:
The abstract operation BalanceISODate takes arguments year (an integer), month (an integer), and day (an integer) and returns an ISO Date Record.
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.
It performs the following steps when called:
The abstract operation PadISOYear takes argument y (an integer) and returns a String. 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. It performs the following steps when called:
The abstract operation TemporalDateToString takes arguments temporalDate (a Temporal.PlainDate) and showCalendar ("auto", "always", "never", or "critical") and returns a String. It formats temporalDate to an ISO 8601 string. It performs the following steps when called:
Return the string-concatenation of year, the code unit 0x002D (HYPHEN-MINUS), month, the code unit 0x002D (HYPHEN-MINUS), day, and calendar.
3.5.14 ISODateWithinLimits ( year, month, day )
The abstract operation ISODateWithinLimits takes arguments year (an integer), month (an integer between 1 and 12 inclusive), and day (an integer between 1 and 31 inclusive) and returns a Boolean. The return value is true if the date in the ISO 8601 calendar given by the arguments is within the representable range of Temporal.PlainDate, and false otherwise.
Note
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.
The abstract operation AddISODate takes arguments year (an integer), month (an integer), day (an integer), years (an integer), months (an integer), weeks (an integer), days (an integer), and overflow ("constrain" or "reject") and returns either a normal completion containing an ISO Date Record or a throw completion.
It adds the duration denoted by years, months, weeks, days to the date denoted by year, month, day, according to ISO 8601 calendar arithmetic.
If addition of years or months results in a nonexistent date, depending on overflow it will be coerced to an existing date or the operation will throw.
It performs the following steps when called:
Set intermediate to ? RegulateISODate(intermediate.[[Year]], intermediate.[[Month]], day, overflow).
Set days to days + 7 × weeks.
Let d be intermediate.[[Day]] + days.
Let result be BalanceISODate(intermediate.[[Year]], intermediate.[[Month]], d).
If ISODateWithinLimits(result.[[Year]], result.[[Month]], result.[[Day]]) is false, throw a RangeError exception.
Return result.
3.5.16 CompareISODate ( y1, m1, d1, y2, m2, d2 )
The abstract operation CompareISODate takes arguments y1 (an integer), m1 (an integer), d1 (an integer), y2 (an integer), m2 (an integer), and d2 (an integer) and returns -1, 0, or 1. It performs a comparison of the two dates denoted by y1, m1, d1 and _y2, m2, d2 according to ISO 8601 calendar arithmetic. It performs the following steps when called:
The abstract operation DifferenceTemporalPlainDate takes arguments operation (since or until), temporalDate (a Temporal.PlainDate), other (an ECMAScript language value), and options (an ECMAScript language value) and returns either a normal completion containing a Temporal.Duration or a throw completion. It computes the difference between the two times represented by temporalDate and other, optionally rounds it, and returns it as a Temporal.Duration object. It performs the following steps when called:
If operation is since, let sign be -1. Otherwise, let sign be 1.
Let settings be ? GetDifferenceSettings(operation, resolvedOptions, date, « », "day", "day").
If temporalDate.[[ISOYear]] = other.[[ISOYear]], and temporalDate.[[ISOMonth]] = other.[[ISOMonth]], and temporalDate.[[ISODay]] = other.[[ISODay]], then
If settings.[[SmallestUnit]] is "day" and settings.[[RoundingIncrement]] = 1, let roundingGranularityIsNoop be true; else let roundingGranularityIsNoop be false.
If roundingGranularityIsNoop is false, then
Let destEpochNs be GetUTCEpochNanoseconds(isoOther.[[Year]], isoOther.[[Month]], isoOther.[[Day]], 0, 0, 0, 0, 0, 0).
Let dateTime be ISO Date-Time Record { [[Year]]: isoDate.[[Year]], [[Month]]: isoDate.[[Month]], [[Day]]: isoDate.[[Day]], [[Hour]]: 0, [[Minute]]: 0, [[Second]]: 0, [[Millisecond]]: 0, [[Microsecond]]: 0, [[Nanosecond]]: 0 }.
Set duration to ? RoundRelativeDuration(duration, destEpochNs, dateTime, unset, temporalDate.[[Calendar]], settings.[[LargestUnit]], settings.[[RoundingIncrement]], settings.[[SmallestUnit]], settings.[[RoundingMode]]).
The abstract operation AddDurationToDate takes arguments operation (add or subtract), temporalDate (a Temporal.PlainDate), temporalDurationLike (an ECMAScript language value), and options (an ECMAScript language value) and returns either a normal completion containing a Temporal.PlainDate or a throw completion. It adds/subtracts temporalDurationLike to/from temporalDate, returning a point in time that is in the future/past relative to temporalDate. It performs the following steps when called:
If operation is subtract, let sign be -1. Otherwise, let sign be 1.
A Temporal.PlainTime object is an Object that contains integers corresponding to a particular hour, minute,
second, millisecond, microsecond, and nanosecond.
creates and initializes a new Temporal.PlainTime object when called as a constructor.
is not intended to be called as a function and will throw an exception when called in that manner.
may be used as the value of an extends clause of a class definition.
Subclass constructors that intend to inherit the specified Temporal.PlainTime behaviour must
include a super call to the %Temporal.PlainTime% constructor to create and initialize subclass
instances with the necessary internal slots.
The initial value of the %Symbol.toStringTag% property is the String value "Temporal.PlainTime".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
4.3.3 get Temporal.PlainTime.prototype.hour
Temporal.PlainTime.prototype.hour is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainTime.prototype.minute is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainTime.prototype.second is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
4.3.6 get Temporal.PlainTime.prototype.millisecond
Temporal.PlainTime.prototype.millisecond is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
4.3.7 get Temporal.PlainTime.prototype.microsecond
Temporal.PlainTime.prototype.microsecond is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainTime.prototype.nanosecond is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
NOTE: The following steps read options and perform independent validation in alphabetical order (ToTemporalRoundingIncrement reads "roundingIncrement" and ToTemporalRoundingMode reads "roundingMode").
Let result be RoundTime(temporalTime.[[ISOHour]], temporalTime.[[ISOMinute]], temporalTime.[[ISOSecond]], temporalTime.[[ISOMillisecond]], temporalTime.[[ISOMicrosecond]], temporalTime.[[ISONanosecond]], roundingIncrement, smallestUnit, roundingMode).
NOTE: The following steps read options and perform independent validation in alphabetical order (ToFractionalSecondDigits reads "fractionalSecondDigits" and ToTemporalRoundingMode reads "roundingMode").
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:
Throw a TypeError exception.
Note
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().
4.4 Properties of Temporal.PlainTime Instances
Temporal.PlainTime instances are ordinary objects that inherit properties from the %Temporal.PlainTime.prototype% intrinsic object.
Temporal.PlainTime instances are initially created with the internal slots described in Table 3.
Table 3: Internal Slots of Temporal.PlainTime Instances
Internal Slot
Description
[[InitializedTemporalTime]]
The only specified use of this slot is for distinguishing Temporal.PlainTime instances from other objects.
[[ISOHour]]
An integer between 0 and 23, inclusive, representing the hour of the day.
[[ISOMinute]]
An integer between 0 and 59, inclusive, representing the minute of the hour.
[[ISOSecond]]
An integer between 0 and 59, inclusive, representing the second within the minute.
[[ISOMillisecond]]
An integer between 0 and 999, inclusive, representing the millisecond within the second.
[[ISOMicrosecond]]
An integer between 0 and 999, inclusive, representing the microsecond within the millisecond.
[[ISONanosecond]]
An integer between 0 and 999, inclusive, representing the nanosecond within the microsecond.
4.5 Abstract Operations
4.5.1 Time Records
A Time Record is a Record value used to represent a valid clock time, together with a number of overflow days such as might occur in BalanceTime.
For any Time Record t, IsValidTime(t.[[Hour]], t.[[Minute]], t.[[Second]], t.[[Millisecond]], t.[[Microsecond]], t.[[Nanosecond]]) must return true.
The abstract operation DifferenceTime takes arguments h1 (an integer between 0 and 23 inclusive), min1 (an integer between 0 and 59 inclusive), s1 (an integer between 0 and 59 inclusive), ms1 (an integer between 0 and 999 inclusive), mus1 (an integer between 0 and 999 inclusive), ns1 (an integer between 0 and 999 inclusive), h2 (an integer between 0 and 23 inclusive), min2 (an integer between 0 and 59 inclusive), s2 (an integer between 0 and 59 inclusive), ms2 (an integer between 0 and 999 inclusive), mus2 (an integer between 0 and 999 inclusive), and ns2 (an integer between 0 and 999 inclusive) and returns a Normalized Time Duration Record. It returns the elapsed duration from a first wall-clock time, until a second wall-clock time. It performs the following steps when called:
Let hours be h2 - h1.
Let minutes be min2 - min1.
Let seconds be s2 - s1.
Let milliseconds be ms2 - ms1.
Let microseconds be mus2 - mus1.
Let nanoseconds be ns2 - ns1.
Let norm be NormalizeTimeDuration(hours, minutes, seconds, milliseconds, microseconds, nanoseconds).
The abstract operation ToTemporalTime takes argument item (an ECMAScript language value) and optional argument options (an ECMAScript language value) and returns either a normal completion containing a Temporal.PlainTime or a throw Completion. It returns its argument item if it is already a Temporal.PlainTime instance, converts item to a new Temporal.PlainTime instance if possible, and throws otherwise. It performs the following steps when called:
If options is not present, set options to undefined.
Set result to ? RegulateTime(result.[[Hour]], result.[[Minute]], result.[[Second]], result.[[Millisecond]], result.[[Microsecond]], result.[[Nanosecond]], overflow).
The abstract operation ToTemporalTimeOrMidnight takes argument item (an ECMAScript language value) and returns either a normal completion containing a Temporal.PlainTime or a throw completion. It returns its argument item if it is already a Temporal.PlainTime instance, converts item to a new Temporal.PlainTime instance if possible, considering undefined to be the same as midnight, and throws otherwise. It performs the following steps when called:
The abstract operation RegulateTime takes arguments hour (an integer), minute (an integer), second (an integer), millisecond (an integer), microsecond (an integer), nanosecond (an integer), and overflow ("constrain" or "reject") and returns either a normal completion containing a Time Record or a throw completion.
It applies the correction given by overflow to the given time.
If overflow is "constrain", out-of-range values are clamped.
If overflow is "reject", a RangeError is thrown if any values are out of range.
It performs the following steps when called:
The abstract operation IsValidTime takes arguments hour (an integer), minute (an integer), second (an integer), millisecond (an integer), microsecond (an integer), and nanosecond (an integer) and returns a Boolean.
The return value is true if its arguments form a valid time of day, and false otherwise.
Leap seconds are not taken into account.
It performs the following steps when called:
The abstract operation BalanceTime takes arguments hour (an integer), minute (an integer), second (an integer), millisecond (an integer), microsecond (an integer), and nanosecond (an integer) and returns a Time Record. It performs the following steps when called:
Set microsecond to microsecond + floor(nanosecond / 1000).
The abstract operation ConstrainTime takes arguments hour (an integer), minute (an integer), second (an integer), millisecond (an integer), microsecond (an integer), and nanosecond (an integer) and returns a Time Record. It clamps any out-of-range components of the given time so they are in range. It performs the following steps when called:
Set hour to the result of clampinghour between 0 and 23.
Set minute to the result of clampingminute between 0 and 59.
Set second to the result of clampingsecond between 0 and 59.
Set millisecond to the result of clampingmillisecond between 0 and 999.
Set microsecond to the result of clampingmicrosecond between 0 and 999.
Set nanosecond to the result of clampingnanosecond between 0 and 999.
Return Time Record {
[[Days]]: 0,
[[Hour]]: hour,
[[Minute]]: minute,
[[Second]]: second,
[[Millisecond]]: millisecond,
[[Microsecond]]: microsecond,
[[Nanosecond]]: nanosecond
}.
The abstract operation CreateTemporalTime takes arguments hour (an integer), minute (an integer), second (an integer), millisecond (an integer), microsecond (an integer), and nanosecond (an integer) and optional argument newTarget (a constructor) and returns either a normal completion containing a Temporal.PlainTime or a throw completion. It creates a new Temporal.PlainTime instance and fills the internal slots with valid values. It performs the following steps when called:
If IsValidTime(hour, minute, second, millisecond, microsecond, nanosecond) is false, throw a RangeError exception.
If newTarget is not present, set newTarget to %Temporal.PlainTime%.
Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.PlainTime.prototype%", « [[InitializedTemporalTime]], [[ISOHour]], [[ISOMinute]], [[ISOSecond]], [[ISOMillisecond]], [[ISOMicrosecond]], [[ISONanosecond]] »).
The abstract operation ToTemporalTimeRecord takes argument temporalTimeLike (an Object) and optional argument completeness (partial or complete) and returns either a normal completion containing a TemporalTimeLike Record or a throw completion. It performs the following steps when called:
If completeness is not present, set completeness to complete.
If completeness is complete, then
Let result be a new TemporalTimeLike Record with each field set to 0.
Else,
Let result be a new TemporalTimeLike Record with each field set to unset.
The abstract operation DifferenceTemporalPlainTime takes arguments operation (since or until), temporalTime (a Temporal.PlainTime), other (an ECMAScript language value), and options (an ECMAScript language value) and returns either a normal completion containing a Temporal.Duration or a throw completion. It computes the difference between the two times represented by temporalTime and other, optionally rounds it, and returns it as a Temporal.Duration object. It performs the following steps when called:
If operation is since, let sign be -1. Otherwise, let sign be 1.
The abstract operation AddDurationToOrSubtractDurationFromPlainTime takes arguments operation (add or subtract), temporalTime (a Temporal.PlainTime), and temporalDurationLike (an ECMAScript language value) and returns either a normal completion containing a Temporal.PlainTime or a throw completion. It adds/subtracts temporalDurationLike to/from temporalTime, returning a point in time that is in the future/past relative to temporalTime. It performs the following steps when called:
If operation is subtract, let sign be -1. Otherwise, let sign be 1.
Let result be AddTime(temporalTime.[[ISOHour]], temporalTime.[[ISOMinute]], temporalTime.[[ISOSecond]], temporalTime.[[ISOMillisecond]], temporalTime.[[ISOMicrosecond]], temporalTime.[[ISONanosecond]], norm).
A Temporal.PlainDateTime object is an Object that contains integers corresponding to a particular year, month, day, hour, minute, second, millisecond, microsecond, and nanosecond.
creates and initializes a new Temporal.PlainDateTime object when called as a constructor.
is not intended to be called as a function and will throw an exception when called in that manner.
may be used as the value of an extends clause of a class definition.
Subclass constructors that intend to inherit the specified Temporal.PlainDateTime behaviour must
include a super call to the %Temporal.PlainDateTime% constructor to create and initialize subclass
instances with the necessary internal slots.
An ECMAScript implementation that includes the ECMA-402 Internationalization API extends this prototype with additional properties in order to represent calendar data.
The initial value of the %Symbol.toStringTag% property is the String value "Temporal.PlainDateTime".
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
5.3.3 get Temporal.PlainDateTime.prototype.calendarId
Temporal.PlainDateTime.prototype.calendarId is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDate.prototype.era is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.5 get Temporal.PlainDateTime.prototype.eraYear
Temporal.PlainDateTime.prototype.eraYear is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDateTime.prototype.year is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDateTime.prototype.month is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.8 get Temporal.PlainDateTime.prototype.monthCode
Temporal.PlainDateTime.prototype.monthCode is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDateTime.prototype.day is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
Temporal.PlainDateTime.prototype.hour is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.11 get Temporal.PlainDateTime.prototype.minute
Temporal.PlainDateTime.prototype.minute is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.12 get Temporal.PlainDateTime.prototype.second
Temporal.PlainDateTime.prototype.second is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.13 get Temporal.PlainDateTime.prototype.millisecond
Temporal.PlainDateTime.prototype.millisecond is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.14 get Temporal.PlainDateTime.prototype.microsecond
Temporal.PlainDateTime.prototype.microsecond is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.15 get Temporal.PlainDateTime.prototype.nanosecond
Temporal.PlainDateTime.prototype.nanosecond is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.16 get Temporal.PlainDateTime.prototype.dayOfWeek
Temporal.PlainDateTime.prototype.dayOfWeek is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.17 get Temporal.PlainDateTime.prototype.dayOfYear
Temporal.PlainDateTime.prototype.dayOfYear is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.18 get Temporal.PlainDateTime.prototype.weekOfYear
Temporal.PlainDateTime.prototype.weekOfYear is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps:
5.3.19 get Temporal.PlainDateTime.prototype.yearOfWeek
Temporal.PlainDateTime.prototype.yearOfWeek is an accessor property whose set accessor function is undefined.
Its get accessor function performs the following steps: