Limited supportA strong long-term direction for serious date and time handling, especially when time zones and exactness matter.

Overview

Temporal is the modern JavaScript date and time API designed to replace many of Date's long-standing pitfalls. It models time zones, calendars, exact instants, and plain dates more clearly.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
144
144
139
Preview
144

The toTemporalInstant() method of Date instances returns a new Temporal.Instant object with the same Temporal/Instant/epochMilliseconds value as this date's timestamp.

144
144
139
Preview
144

The Temporal.Duration object represents a difference between two time points, which can be used in date/time arithmetic. It is fundamentally represented as a combination of years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, and nanoseconds values.

144
144
139
Preview
144

The Temporal.Duration() constructor creates Temporal.Duration objects.

144
144
139
Preview
144

The abs() method of Temporal.Duration instances returns a new Temporal.Duration object with the absolute value of this duration (all fields have the same magnitude, but sign becomes positive).

144
144
139
Preview
144

The add() method of Temporal.Duration instances returns a new Temporal.Duration object with the sum of this duration and a given duration. The result is balanced.

144
144
139
144

The blank accessor property of Temporal.Duration instances returns a boolean that is true if this duration represents a zero duration, and false otherwise. It is equivalent to duration.sign === 0.

144
144
139
Preview
144

The Temporal.Duration.compare() static method returns a number (-1, 0, or 1) indicating whether the first duration is shorter, equal to, or longer than the second duration.

144
144
139
Preview
144

The days accessor property of Temporal.Duration instances returns an integer representing the number of days in the duration.

144
144
139
Preview
144

The Temporal.Duration.from() static method creates a new Temporal.Duration object from another Temporal.Duration object, an object with duration properties, or an ISO 8601 string.

144
144
139
Preview
144

The hours accessor property of Temporal.Duration instances returns an integer representing the number of hours in the duration.

144
144
139
Preview
144

The microseconds accessor property of Temporal.Duration instances returns an integer representing the number of microseconds in the duration.

144
144
139
Preview
144

The milliseconds accessor property of Temporal.Duration instances returns an integer representing the number of milliseconds in the duration.

144
144
139
Preview
144

The minutes accessor property of Temporal.Duration instances returns an integer representing the number of minutes in the duration.

144
144
139
Preview
144

The months accessor property of Temporal.Duration instances returns an integer representing the number of months in the duration.

144
144
139
Preview
144

The nanoseconds accessor property of Temporal.Duration instances returns an integer representing the number of nanoseconds in the duration.

144
144
139
Preview
144

The negated() method of Temporal.Duration instances returns a new Temporal.Duration object with the negated value of this duration (all fields keep the same magnitude, but sign becomes reversed).

144
144
139
Preview
144

The round() method of Temporal.Duration instances returns a new Temporal.Duration object with the duration rounded to the given smallest unit and/or balanced to the given largest unit.

144
144
139
144

The seconds accessor property of Temporal.Duration instances returns an integer representing the number of seconds in the duration.

144
144
139
Preview
144

The sign accessor property of Temporal.Duration instances returns 1 if this duration is positive, -1 if negative, and 0 if zero. Because a duration never has mixed signs, the sign of a duration is determined by the sign of any of its non-zero fields.

144
144
139
Preview
144

The subtract() method of Temporal.Duration instances returns a new Temporal.Duration object with the difference between this duration and a given duration. It is equivalent to adding the negated value of the other duration.

144
144
139
144

The toJSON() method of Temporal.Duration instances returns a string representing this duration in the same ISO 8601 format as calling Temporal/Duration/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
Preview
144

The toLocaleString() method of Temporal.Duration instances returns a string with a language-sensitive representation of this duration. In implementations with Intl.DurationFormat API support, this method delegates to Intl.DurationFormat.

144
144
139
144

The toString() method of Temporal.Duration instances returns a string representing this duration in the ISO 8601 format.

144
144
139
Preview
144

The total() method of Temporal.Duration instances returns a number representing the total duration in the given unit.

144
144
139
144

The valueOf() method of Temporal.Duration instances throws a TypeError, which prevents Temporal.Duration instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
Preview
144

The weeks accessor property of Temporal.Duration instances returns an integer representing the number of weeks in the duration.

144
144
139
Preview
144

The with() method of Temporal.Duration instances returns a new Temporal.Duration object representing this duration 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 duration's fields.

144
144
139
Preview
144

The years accessor property of Temporal.Duration instances returns an integer representing the number of years in the duration.

144
144
139
Preview
144

The Temporal.Instant object represents a unique point in time, with nanosecond precision. It is fundamentally represented as the number of nanoseconds since the Unix epoch (midnight at the beginning of January 1, 1970, UTC), without any time zone or calendar system.

144
144
139
Preview
144

The Temporal.Instant() constructor creates Temporal.Instant objects.

139
Preview

The add() method of Temporal.Instant instances returns a new Temporal.Instant object representing this instant moved forward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
Preview
144

The Temporal.Instant.compare() static method returns a number (-1, 0, or 1) indicating whether the first instant comes before, is the same as, or comes after the second instant. It is equivalent to comparing the Temporal/Instant/epochNanoseconds of the two instants.

144
144
139
144

The epochMilliseconds accessor property of Temporal.Instant instances returns an integer representing the number of milliseconds elapsed since the Unix epoch (midnight at the beginning of January 1, 1970, UTC) to this instant. It is equivalent to dividing epochNanoseconds by 1e6 and flooring the result.

144
144
139
Preview
144

The epochNanoseconds accessor property of Temporal.Instant instances returns a BigInt representing the number of nanoseconds elapsed since the Unix epoch (midnight at the beginning of January 1, 1970, UTC) to this instant.

144
144
139
Preview
144

The equals() method of Temporal.Instant instances returns true if this instant is equivalent in value to another instant (in a form convertible by Temporal/Instant/from), and false otherwise. They are compared by their Temporal/Instant/epochNanoseconds. It is equivalent to Temporal.Instant.compare(this, other) === 0.

144
144
139
Preview
144

The Temporal.Instant.from() static method creates a new Temporal.Instant object from another Temporal.Instant object, or an RFC 9557 string.

144
144
139
Preview
144

The Temporal.Instant.fromEpochMilliseconds() static method creates a new Temporal.Instant object from the number of milliseconds since the Unix epoch (midnight at the beginning of January 1, 1970, UTC).

144
144
139
Preview
144

The Temporal.Instant.fromEpochNanoseconds() static method creates a new Temporal.Instant object from the number of nanoseconds since the Unix epoch (midnight at the beginning of January 1, 1970, UTC).

144
144
139
Preview
144

The round() method of Temporal.Instant instances returns a new Temporal.Instant object representing this instant rounded to the given unit.

144
144
139
Preview
144

The since() method of Temporal.Instant instances returns a new Temporal.Duration object representing the duration from another instant (in a form convertible by Temporal/Instant/from) to this instant. The duration is positive if the other instant is before this instant, and negative if after.

144
144
139
Preview
144

The subtract() method of Temporal.Instant instances returns a new Temporal.Instant object representing this instant moved backward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
Preview
144

The toJSON() method of Temporal.Instant instances returns a string representing this instant in the same RFC 9557 format as calling Temporal/Instant/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
Preview
144

The toLocaleString() method of Temporal.Instant instances returns a string with a language-sensitive representation of this instant. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.

144
144
139
Preview
144

The toString() method of Temporal.Instant instances returns a string representing this instant in the RFC 9557 format using the specified time zone.

144
144
139
Preview
144

The toZonedDateTimeISO() method of Temporal.Instant instances returns a new Temporal.ZonedDateTime object representing this instant in the specified time zone using the ISO 8601 calendar system.

144
144
139
144

The until() method of Temporal.Instant instances returns a new Temporal.Duration object representing the duration from this instant to another instant (in a form convertible by Temporal/Instant/from). The duration is positive if the other instant is after this instant, and negative if before.

144
144
139
Preview
144

The valueOf() method of Temporal.Instant instances throws a TypeError, which prevents Temporal.Instant instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
Preview
144

The Temporal.Now namespace object contains static methods for getting the current time in various formats.

144
144
139
144

The Temporal.Now.instant() static method returns the current time as a Temporal.Instant object.

144
144
139
144

The Temporal.Now.plainDateISO() static method returns the current date as a Temporal.PlainDate object, in the ISO 8601 calendar and the specified time zone.

144
144
139
144

The Temporal.Now.plainDateTimeISO() static method returns the current date and time as a Temporal.PlainDateTime object, in the ISO 8601 calendar and the specified time zone.

144
144
139
144

The Temporal.Now.plainTimeISO() static method returns the current time as a Temporal.PlainTime object, in the specified time zone.

144
144
139
144

The Temporal.Now.timeZoneId() static method returns a time zone identifier representing the system's current time zone. Most systems will return a primary time zone identifier such as "America/New_York", though offset time zone identifier such as "-04:00" is possible too. The time zone identifier returned is the default time zone used by the other…

144
144
139
144

The Temporal.Now.zonedDateTimeISO() static method returns the current date and time as a Temporal.ZonedDateTime object, in the ISO 8601 calendar and the specified time zone.

144
144
139
144

The Temporal.PlainDate object represents a calendar date (a date without a time or time zone); for example, an event on a calendar which happens during the whole day no matter which time zone it's happening in. It is fundamentally represented as an ISO 8601 calendar date, with year, month, and day fields, and an associated calendar system.

144
144
139
144

The Temporal.PlainDate() constructor creates Temporal.PlainDate objects.

139

The add() method of Temporal.PlainDate instances returns a new Temporal.PlainDate object representing this date moved forward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The calendarId accessor property of Temporal.PlainDate instances returns a string representing the calendar used to interpret the internal ISO 8601 date.

144
144
139
144

The Temporal.PlainDate.compare() static method returns a number (-1, 0, or 1) indicating whether the first date comes before, is the same as, or comes after the second date. Equivalent to comparing the year, month, and day fields of the underlying ISO 8601 dates.

144
144
139
144

The day accessor property of Temporal.PlainDate instances returns a positive integer representing the 1-based day index in the month of this date, which is the same day number you would see on a calendar. It is calendar-dependent.

144
144
139
144

The dayOfWeek accessor property of Temporal.PlainDate instances returns a positive integer representing the 1-based day index in the week of this date. Days in a week are numbered sequentially from 1 to Temporal/PlainDate/daysInWeek, with each number mapping to its name. It is calendar-dependent. 1 usually represents Monday in the calendar, even when…

144
144
139
144

The dayOfYear accessor property of Temporal.PlainDate instances returns a positive integer representing the 1-based day index in the year of this date. The first day of this year is 1, and the last day is the Temporal/PlainDate/daysInYear. It is calendar-dependent.

144
144
139
144

The daysInMonth accessor property of Temporal.PlainDate instances returns a positive integer representing the number of days in the month of this date. It is calendar-dependent.

144
144
139
144

The daysInWeek accessor property of Temporal.PlainDate instances returns a positive integer representing the number of days in the week of this date. It is calendar-dependent.

144
144
139
144

The daysInYear accessor property of Temporal.PlainDate instances returns a positive integer representing the number of days in the year of this date. It is calendar-dependent.

144
144
139
144

The equals() method of Temporal.PlainDate instances returns true if this date is equivalent in value to another date (in a form convertible by Temporal/PlainDate/from), and false otherwise. They are compared both by their date values and their calendars, so two dates from different calendars may be considered equal by Temporal/PlainDate/compare but not by…

144
144
139
144

The era accessor property of Temporal.PlainDate instances returns a calendar-specific lowercase string representing the era of this date, or undefined if the calendar does not use eras (e.g., ISO 8601). era and eraYear together uniquely identify a year in a calendar, in the same way that year does. It is calendar-dependent. For Gregorian, it is either "ce"…

144
144
139
144

The eraYear accessor property of Temporal.PlainDate instances returns a non-negative integer representing the year of this date within the era, or undefined if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). era and eraYear together…

144
144
139
144

The Temporal.PlainDate.from() static method creates a new Temporal.PlainDate object from another Temporal.PlainDate object, an object with date properties, or an RFC 9557 string.

144
144
139
144

The inLeapYear accessor property of Temporal.PlainDate instances returns a boolean indicating whether this date is in a leap year. A leap year is a year that has more days (due to a leap day or leap month) than a common year. It is calendar-dependent.

144
144
139
144

The month accessor property of Temporal.PlainDate instances returns a positive integer representing the 1-based month index in the year of this date. The first month of this year is 1, and the last month is the Temporal/PlainDate/monthsInYear. It is calendar-dependent.

144
144
139
144

The monthCode accessor property of Temporal.PlainDate instances returns a calendar-specific string representing the month of this date. It is calendar-dependent.

144
144
139
144

The monthsInYear accessor property of Temporal.PlainDate instances returns a positive integer representing the number of months in the year of this date. It is calendar-dependent.

144
144
139
144

The since() method of Temporal.PlainDate instances returns a new Temporal.Duration object representing the duration from another date (in a form convertible by Temporal/PlainDate/from) to this date. The duration is positive if the other date is before this date, and negative if after.

144
144
139
144

The subtract() method of Temporal.PlainDate instances returns a new Temporal.PlainDate object representing this date moved backward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The toJSON() method of Temporal.PlainDate instances returns a string representing this date in the same RFC 9557 format as calling Temporal/PlainDate/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
144

The toLocaleString() method of Temporal.PlainDate instances returns a string with a language-sensitive representation of this date. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.

144
144
139
144

The toPlainDateTime() method of Temporal.PlainDate instances returns a new Temporal.PlainDateTime object representing this date and a supplied time in the same calendar system.

144
144
139
144

The toPlainMonthDay() method of Temporal.PlainDate instances returns a new Temporal.PlainMonthDay object representing the Temporal/PlainDate/monthCode and Temporal/PlainDate/day of this date in the same calendar system.

144
144
139
144

The toPlainYearMonth() method of Temporal.PlainDate instances returns a new Temporal.PlainYearMonth object representing the Temporal/PlainDate/year and Temporal/PlainDate/month of this date in the same calendar system.

144
144
139
144

The toString() method of Temporal.PlainDate instances returns a string representing this date in the RFC 9557 format.

144
144
139
144

The toZonedDateTime() method of Temporal.PlainDate instances returns a new Temporal.ZonedDateTime object representing this date, a supplied time, and a supplied time zone, in the same calendar system.

144
144
139
144

The until() method of Temporal.PlainDate instances returns a new Temporal.Duration object representing the duration from this date to another date (in a form convertible by Temporal/PlainDate/from). The duration is positive if the other date is after this date, and negative if before.

144
144
139
144

The valueOf() method of Temporal.PlainDate instances throws a TypeError, which prevents Temporal.PlainDate instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
144

The weekOfYear accessor property of Temporal.PlainDate instances returns a positive integer representing the 1-based week index in the Temporal/PlainDate/yearOfWeek of this date, or undefined if the calendar does not have a well-defined week system. The first week of the year is 1. It is calendar-dependent.

144
144
139
144

The with() method of Temporal.PlainDate instances returns a new Temporal.PlainDate object representing this date 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 date's fields.

144
144
139
144

The withCalendar() method of Temporal.PlainDate instances returns a new Temporal.PlainDate object representing this date interpreted in the new calendar system. Because all Temporal objects are designed to be immutable, this method essentially functions as the setter for the date's Temporal/PlainDate/calendarId property.

144
144
139
144

The year accessor property of Temporal.PlainDate instances returns an integer representing the number of years of this date relative to the start of a calendar-specific epoch year. This property has the same function as the Temporal/PlainDate/era/Temporal/PlainDate/eraYear pair as a unique identifier of a year in a calendar. It is calendar-dependent.

144
144
139
144

The yearOfWeek accessor property of Temporal.PlainDate instances returns an integer representing the year to be paired with the Temporal/PlainDate/weekOfYear of this date, or undefined if the calendar does not have a well-defined week system. It is calendar-dependent.

144
144
139
144

The Temporal.PlainDateTime object represents a date (calendar date) and time (wall-clock time) without a time zone. It is fundamentally represented as a combination of a date (with an associated calendar system) and a time.

144
144
139
144

The Temporal.PlainDateTime() constructor creates Temporal.PlainDateTime objects.

139

The add() method of Temporal.PlainDateTime instances returns a new Temporal.PlainDateTime object representing this date-time moved forward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The calendarId accessor property of Temporal.PlainDateTime instances returns a string representing the calendar used to interpret the internal ISO 8601 date.

144
144
139
144

The Temporal.PlainDateTime.compare() static method returns a number (-1, 0, or 1) indicating whether the first date-time comes before, is the same as, or comes after the second date-time. Equivalent to first comparing their dates, then comparing their times if the dates are the same.

144
144
139
144

The day accessor property of Temporal.PlainDateTime instances returns a positive integer representing the 1-based day index in the month of this date, which is the same day number you would see on a calendar. It is calendar-dependent.

144
144
139
144

The dayOfWeek accessor property of Temporal.PlainDateTime instances returns a positive integer representing the 1-based day index in the week of this date. Days in a week are numbered sequentially from 1 to Temporal/PlainDateTime/daysInWeek, with each number mapping to its name. It is calendar-dependent.

144
144
139
144

The dayOfYear accessor property of Temporal.PlainDateTime instances returns a positive integer representing the 1-based day index in the year of this date. The first day of this year is 1, and the last day is the Temporal/PlainDateTime/daysInYear. It is calendar-dependent.

144
144
139
144

The daysInMonth accessor property of Temporal.PlainDateTime instances returns a positive integer representing the number of days in the month of this date. It is calendar-dependent.

144
144
139
144

The daysInWeek accessor property of Temporal.PlainDateTime instances returns a positive integer representing the number of days in the week of this date. It is calendar-dependent.

144
144
139
144

The daysInYear accessor property of Temporal.PlainDateTime instances returns a positive integer representing the number of days in the year of this date. It is calendar-dependent.

144
144
139
144

The equals() method of Temporal.PlainDateTime instances returns true if this date-time is equivalent in value to another date-time (in a form convertible by Temporal/PlainDate/from), and false otherwise. They are compared both by their date and time values and their calendars, so two date-times from different calendars may be considered equal by…

144
144
139
144

The era accessor property of Temporal.PlainDateTime instances returns a calendar-specific lowercase string representing the era of this date, or undefined if the calendar does not use eras (e.g., ISO 8601). era and eraYear together uniquely identify a year in a calendar, in the same way that year does. It is calendar-dependent.

144
144
139
144

The eraYear accessor property of Temporal.PlainDateTime instances returns a non-negative integer representing the year of this date within the era, or undefined if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). era and eraYear…

144
144
139
144

The Temporal.PlainDateTime.from() static method creates a new Temporal.PlainDateTime object from another Temporal.PlainDateTime object, an object with date and time properties, or an RFC 9557 string.

144
144
139
144

The hour accessor property of Temporal.PlainDateTime instances returns an integer from 0 to 23 representing the hour component of this time.

144
144
139
144

The inLeapYear accessor property of Temporal.PlainDateTime instances returns a boolean indicating whether this date is in a leap year. A leap year is a year that has more days (due to a leap day or leap month) than a common year. It is calendar-dependent.

144
144
139
144

The microsecond accessor property of Temporal.PlainDateTime instances returns an integer from 0 to 999 representing the microsecond (10-6 second) component of this time.

144
144
139
144

The millisecond accessor property of Temporal.PlainDateTime instances returns an integer from 0 to 999 representing the millisecond (10-3 second) component of this time.

144
144
139
144

The minute accessor property of Temporal.PlainDateTime instances returns an integer from 0 to 59 representing the minute component of this time.

144
144
139
144

The month accessor property of Temporal.PlainDateTime instances returns a positive integer representing the 1-based month index in the year of this date. The first month of this year is 1, and the last month is the Temporal/PlainDateTime/monthsInYear. It is calendar-dependent.

144
144
139
144

The monthCode accessor property of Temporal.PlainDateTime instances returns a calendar-specific string representing the month of this date. It is calendar-dependent.

144
144
139
144

The monthsInYear accessor property of Temporal.PlainDateTime instances returns a positive integer representing the number of months in the year of this date. It is calendar-dependent.

144
144
139
144

The nanosecond accessor property of Temporal.PlainDateTime instances returns an integer from 0 to 999 representing the nanosecond (10-9 second) component of this time.

144
144
139
144

The round() method of Temporal.PlainDateTime instances returns a new Temporal.PlainDateTime object representing this date-time rounded to the given unit.

144
144
139
144

The second accessor property of Temporal.PlainDateTime instances returns an integer from 0 to 59 representing the second component of this time.

144
144
139
144

The since() method of Temporal.PlainDateTime instances returns a new Temporal.Duration object representing the duration from another date-time (in a form convertible by Temporal/PlainDateTime/from) to this date-time. The duration is positive if the other date-time is before this date-time, and negative if after.

144
144
139
144

The subtract() method of Temporal.PlainDateTime instances returns a new Temporal.PlainDateTime object representing this date-time moved backward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The toJSON() method of Temporal.PlainDateTime instances returns a string representing this date-time in the same RFC 9557 format as calling Temporal/PlainDateTime/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
144

The toLocaleString() method of Temporal.PlainDateTime instances returns a string with a language-sensitive representation of this date-time. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.

144
144
139
144

The toPlainDate() method of Temporal.PlainDateTime instances returns a new Temporal.PlainDate object representing the date part (year, month, day) of this date-time in the same calendar system.

144
144
139
144

The toPlainTime() method of Temporal.PlainDateTime instances returns a new Temporal.PlainTime object representing the time part (hour, minute, second, and subsecond components) of this date-time.

144
144
139
144

The toString() method of Temporal.PlainDateTime instances returns a string representing this date-time in the RFC 9557 format.

144
144
139
144

The toZonedDateTime() method of Temporal.PlainDateTime instances returns a new Temporal.ZonedDateTime instance representing the same date-time as this plain date-time, but in the specified time zone.

144
144
139
144

The until() method of Temporal.PlainDateTime instances returns a new Temporal.Duration object representing the duration from this date-time to another date-time (in a form convertible by Temporal/PlainDateTime/from). The duration is positive if the other date-time is after this date-time, and negative if before.

144
144
139
144

The valueOf() method of Temporal.PlainDateTime instances throws a TypeError, which prevents Temporal.PlainDateTime instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
144

The weekOfYear accessor property of Temporal.PlainDateTime instances returns a positive integer representing the 1-based week index in the Temporal/PlainDateTime/yearOfWeek of this date, or undefined if the calendar does not have a well-defined week system. The first week of the year is 1. It is calendar-dependent.

144
144
139
144

The with() method of Temporal.PlainDateTime instances returns a new Temporal.PlainDateTime object representing this date-time 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 date-time's fields.

144
144
139
144

The withCalendar() method of Temporal.PlainDateTime instances returns a new Temporal.PlainDateTime object representing this date-time interpreted in the new calendar system. Because all Temporal objects are designed to be immutable, this method essentially functions as the setter for the date-time's Temporal/PlainDateTime/calendarId property.

144
144
139
144

The withPlainTime() method of Temporal.PlainDateTime instances returns a new Temporal.PlainDateTime object representing this date-time with the time part entirely replaced by the new time (in a form convertible by Temporal/PlainTime/from)

144
144
139
144

The year accessor property of Temporal.PlainDateTime instances returns an integer representing the number of years of this date relative to the start of a calendar-specific epoch year. It is calendar-dependent.

144
144
139
144

The yearOfWeek accessor property of Temporal.PlainDateTime instances returns an integer representing the year to be paired with the Temporal/PlainDateTime/weekOfYear of this date, or undefined if the calendar does not have a well-defined week system. It is calendar-dependent.

144
144
139
144

The Temporal.PlainMonthDay object represents the month and day of a calendar date, without a year or time zone; for example, an event on a calendar that recurs every year and happens during the whole day. It is fundamentally represented as an ISO 8601 calendar date, with year, month, and day fields, and an associated calendar system. The year is used to…

144
144
139
144

The Temporal.PlainMonthDay() constructor creates Temporal.PlainMonthDay objects.

139

The calendarId accessor property of Temporal.PlainMonthDay instances returns a string representing the calendar used to interpret the internal ISO 8601 date.

144
144
139
144

The day accessor property of Temporal.PlainMonthDay instances returns a positive integer representing the 1-based day index in the month of this date, which is the same day number you would see on a calendar. It is calendar-dependent.

144
144
139
144

The equals() method of Temporal.PlainMonthDay instances returns true if this month-day is equivalent in value to another month-day (in a form convertible by Temporal/PlainMonthDay/from), and false otherwise. They are compared both by their underlying ISO date values and their calendars.

144
144
139
144

The Temporal.PlainMonthDay.from() static method creates a new Temporal.PlainMonthDay object from another Temporal.PlainMonthDay object, an object with month and day properties, or an RFC 9557 string.

144
144
139
144

The monthCode accessor property of Temporal.PlainMonthDay instances returns a calendar-specific string representing the month of this date. It is calendar-dependent.

144
144
139
144

The toJSON() method of Temporal.PlainMonthDay instances returns a string representing this month-day in the same RFC 9557 format as calling Temporal/PlainMonthDay/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
144

The toLocaleString() method of Temporal.PlainMonthDay instances returns a string with a language-sensitive representation of this month-day. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.

144
144
139
144

The toPlainDate() method of Temporal.PlainMonthDay instances returns a new Temporal.PlainDate object representing this month-day and a supplied year in the same calendar system.

144
144
139
144

The toString() method of Temporal.PlainMonthDay instances returns a string representing this month-day in the RFC 9557 format.

144
144
139
144

The valueOf() method of Temporal.PlainMonthDay instances throws a TypeError, which prevents Temporal.PlainMonthDay instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
144

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.

144
144
139
144

The Temporal.PlainTime object represents a time without a date or time zone; for example, a recurring event that happens at the same time every day. It is fundamentally represented as a combination of hour, minute, second, millisecond, microsecond, and nanosecond values.

144
144
139
Preview
144

The Temporal.PlainTime() constructor creates Temporal.PlainTime objects.

144
144
139
Preview
144

The add() method of Temporal.PlainTime instances returns a new Temporal.PlainTime object representing this time moved forward by a given duration (in a form convertible by Temporal/Duration/from), wrapping around the clock if necessary.

144
144
139
Preview
144

The Temporal.PlainTime.compare() static method returns a number (-1, 0, or 1) indicating whether the first time comes before, is the same as, or comes after the second time. It is equivalent to comparing the hour, minute, second, millisecond, microsecond, and nanosecond fields one by one.

144
144
139
Preview
144

The equals() method of Temporal.PlainTime instances returns true if this time is equivalent in value to another time (in a form convertible by Temporal/PlainTime/from), and false otherwise. They are compared by their time values. It is equivalent to Temporal.PlainTime.compare(this, other) === 0.

144
144
139
Preview
144

The Temporal.PlainTime.from() static method creates a new Temporal.PlainTime object from another Temporal.PlainTime object, an object with time properties, or an RFC 9557 string.

144
144
139
Preview
144

The hour accessor property of Temporal.PlainTime instances returns an integer from 0 to 23 representing the hour component of this time.

144
144
139
Preview
144

The microsecond accessor property of Temporal.PlainTime instances returns an integer from 0 to 999 representing the microsecond (10-6 second) component of this time.

144
144
139
Preview
144

The millisecond accessor property of Temporal.PlainTime instances returns an integer from 0 to 999 representing the millisecond (10-3 second) component of this time.

144
144
139
Preview
144

The minute accessor property of Temporal.PlainTime instances returns an integer from 0 to 59 representing the minute component of this time.

144
144
139
Preview
144

The nanosecond accessor property of Temporal.PlainTime instances returns an integer from 0 to 999 representing the nanosecond (10-9 second) component of this time.

144
144
139
Preview
144

The round() method of Temporal.PlainTime instances returns a new Temporal.PlainTime object representing this time rounded to the given unit.

144
144
139
Preview
144

The second accessor property of Temporal.PlainTime instances returns an integer from 0 to 59 representing the second component of this time.

144
144
139
Preview
144

The since() method of Temporal.PlainTime instances returns a new Temporal.Duration object representing the duration from another time (in a form convertible by Temporal/PlainTime/from) to this time. The duration is positive if the other time is before this time, and negative if after.

144
144
139
Preview
144

The subtract() method of Temporal.PlainTime instances returns a new Temporal.PlainTime object representing this time moved backward by a given duration (in a form convertible by Temporal/Duration/from), wrapping around the clock if necessary.

144
144
139
Preview
144

The toJSON() method of Temporal.PlainTime instances returns a string representing this time in the same RFC 9557 format as calling Temporal/PlainTime/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
Preview
144

The toLocaleString() method of Temporal.PlainTime instances returns a string with a language-sensitive representation of this time. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.

144
144
139
144

The toString() method of Temporal.PlainTime instances returns a string representing this time in the RFC 9557 format.

144
144
139
Preview
144

The until() method of Temporal.PlainTime instances returns a new Temporal.Duration object representing the duration from this time to another time (in a form convertible by Temporal/PlainTime/from). The duration is positive if the other time is after this time, and negative if before.

144
144
139
Preview
144

The valueOf() method of Temporal.PlainTime instances throws a TypeError, which prevents Temporal.PlainTime instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
Preview
144

The with() method of Temporal.PlainTime instances returns a new Temporal.PlainTime object representing this time 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 time's fields.

144
144
139
Preview
144

The Temporal.PlainYearMonth object represents the year and month of a calendar date, without a day or time zone; for example, an event on a calendar that happens during the whole month. It is fundamentally represented as an ISO 8601 calendar date, with year, month, and day fields, and an associated calendar system. The day is used to disambiguate the…

144
144
139
144

The Temporal.PlainYearMonth() constructor creates Temporal.PlainYearMonth objects.

139

The add() method of Temporal.PlainYearMonth instances returns a new Temporal.PlainYearMonth object representing this year-month moved forward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The calendarId accessor property of Temporal.PlainYearMonth instances returns a string representing the calendar used to interpret the internal ISO 8601 date.

144
144
139
144

The Temporal.PlainYearMonth.compare() static method returns a number (-1, 0, or 1) indicating whether the first year-month comes before, is the same as, or comes after the second year-month. It is equivalent to comparing their underlying ISO 8601 dates. Two year-months from different calendars may be considered equal if they start on the same ISO date.

144
144
139
144

The daysInMonth accessor property of Temporal.PlainYearMonth instances returns a positive integer representing the number of days in the month of this date. It is calendar-dependent.

144
144
139
144

The daysInYear accessor property of Temporal.PlainYearMonth instances returns a positive integer representing the number of days in the year of this date. It is calendar-dependent.

144
144
139
144

The equals() method of Temporal.PlainYearMonth instances returns true if this year-month is equivalent in value to another year-month (in a form convertible by Temporal/PlainYearMonth/from), and false otherwise. They are compared both by their underlying ISO date values and their calendars, so two year-months from different calendars may be considered equal…

144
144
139
144

The era accessor property of Temporal.PlainYearMonth instances returns a calendar-specific lowercase string representing the era of this year-month, or undefined if the calendar does not use eras (e.g., ISO 8601). era and eraYear together uniquely identify a year in a calendar, in the same way that year does. It is calendar-dependent.

144
144
139
144

The eraYear accessor property of Temporal.PlainYearMonth instances returns a non-negative integer representing the year of this year-month within the era, or undefined if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). era and eraYear…

144
144
139
144

The Temporal.PlainYearMonth.from() static method creates a new Temporal.PlainYearMonth object from another Temporal.PlainYearMonth object, an object with year and month properties, or an RFC 9557 string.

144
144
139
144

The inLeapYear accessor property of Temporal.PlainYearMonth instances returns a boolean indicating whether this year-month is in a leap year. A leap year is a year that has more days (due to a leap day or leap month) than a common year. It is calendar-dependent.

144
144
139
144

The month accessor property of Temporal.PlainYearMonth instances returns a positive integer representing the 1-based month index in the year of this year-month. The first month of this year is 1, and the last month is the Temporal/PlainYearMonth/monthsInYear. It is calendar-dependent.

144
144
139
144

The monthCode accessor property of Temporal.PlainYearMonth instances returns a calendar-specific string representing the month of this year-month. It is calendar-dependent.

144
144
139
144

The monthsInYear accessor property of Temporal.PlainYearMonth instances returns a positive integer representing the number of months in the year of this date. It is calendar-dependent.

144
144
139
144

The since() method of Temporal.PlainYearMonth instances returns a new Temporal.Duration object representing the duration from another year-month (in a form convertible by Temporal/PlainYearMonth/from) to this year-month. The duration is positive if the other month is before this month, and negative if after.

144
144
139
144

The subtract() method of Temporal.PlainYearMonth instances returns a new Temporal.PlainYearMonth object representing this year-month moved backward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The toJSON() method of Temporal.PlainYearMonth instances returns a string representing this year-month in the same RFC 9557 format as calling Temporal/PlainYearMonth/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
144

The toLocaleString() method of Temporal.PlainYearMonth instances returns a string with a language-sensitive representation of this year-month. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat.

144
144
139
144

The toPlainDate() method of Temporal.PlainYearMonth instances returns a new Temporal.PlainDate object representing this year-month and a supplied day in the same calendar system.

144
144
139
144

The toString() method of Temporal.PlainYearMonth instances returns a string representing this year-month in the RFC 9557 format.

144
144
139
144

The until() method of Temporal.PlainYearMonth instances returns a new Temporal.Duration object representing the duration from this year-month to another year-month (in a form convertible by Temporal/PlainYearMonth/from). The duration is positive if the other month is after this month, and negative if before.

144
144
139
144

The valueOf() method of Temporal.PlainYearMonth instances throws a TypeError, which prevents Temporal.PlainYearMonth instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
144

The with() method of Temporal.PlainYearMonth instances returns a new Temporal.PlainYearMonth object representing this year-month 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 year-month's fields.

144
144
139
144

The year accessor property of Temporal.PlainYearMonth instances returns an integer representing the number of years of this year-month relative to the start of a calendar-specific epoch year. It is calendar-dependent.

144
144
139
144

The Temporal.ZonedDateTime object represents a date and time with a time zone. It is fundamentally represented as a combination of an instant, a time zone, and a calendar system.

144
144
139
144

The Temporal.ZonedDateTime() constructor creates Temporal.ZonedDateTime objects.

139

The add() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing this date-time moved forward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The calendarId accessor property of Temporal.ZonedDateTime instances returns a string representing the calendar used to interpret the internal ISO 8601 date.

144
144
139
144

The Temporal.ZonedDateTime.compare() static method returns a number (-1, 0, or 1) indicating whether the first date-time comes before, is the same as, or comes after the second date-time. It is equivalent to comparing the Temporal/ZonedDateTime/epochNanoseconds of the two date-times.

144
144
139
144

The day accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the 1-based day index in the month of this date, which is the same day number you would see on a calendar. It is calendar-dependent.

144
144
139
144

The dayOfWeek accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the 1-based day index in the week of this date. Days in a week are numbered sequentially from 1 to Temporal/ZonedDateTime/daysInWeek, with each number mapping to its name. It is calendar-dependent.

144
144
139
144

The dayOfYear accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the 1-based day index in the year of this date. The first day of this year is 1, and the last day is the Temporal/ZonedDateTime/daysInYear. It is calendar-dependent.

144
144
139
144

The daysInMonth accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the number of days in the month of this date. It is calendar-dependent.

144
144
139
144

The daysInWeek accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the number of days in the week of this date. It is calendar-dependent.

144
144
139
144

The daysInYear accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the number of days in the year of this date. It is calendar-dependent.

144
144
139
144

The epochMilliseconds accessor property of Temporal.ZonedDateTime instances returns an integer representing the number of milliseconds elapsed since the Unix epoch (midnight at the beginning of January 1, 1970, UTC) to this instant. It is equivalent to dividing epochNanoseconds by 1e6 and flooring the result.

144
144
139
144

The epochNanoseconds accessor property of Temporal.ZonedDateTime instances returns a BigInt representing the number of nanoseconds elapsed since the Unix epoch (midnight at the beginning of January 1, 1970, UTC) to this instant.

144
144
139
144

The equals() method of Temporal.ZonedDateTime instances returns true if this date-time is equivalent in value to another date-time (in a form convertible by Temporal/ZonedDateTime/from), and false otherwise. They are compared both by their instant values, time zones, and their calendars, so two date-times from different calendars or time zones may be…

144
144
139
144

The era accessor property of Temporal.ZonedDateTime instances returns a calendar-specific lowercase string representing the era of this date, or undefined if the calendar does not use eras (e.g., ISO 8601). era and eraYear together uniquely identify a year in a calendar, in the same way that year does. It is calendar-dependent.

144
144
139
144

The eraYear accessor property of Temporal.ZonedDateTime instances returns a non-negative integer representing the year of this date within the era, or undefined if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). era and eraYear…

144
144
139
144

The Temporal.ZonedDateTime.from() static method creates a new Temporal.ZonedDateTime object from another Temporal.ZonedDateTime object, an object with date, time, and time zone properties, or an RFC 9557 string.

144
144
139
144

The getTimeZoneTransition() method of Temporal.ZonedDateTime instances returns a Temporal.ZonedDateTime object representing the closest instant after or before this instant at which the time zone's UTC offset changes (the returned instant is the first instant after the change), or null if there is no such transition. This is useful for finding out the…

144
144
139
144

The hour accessor property of Temporal.ZonedDateTime instances returns an integer from 0 to 23 representing the hour component of this time.

144
144
139
144

The hoursInDay accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the number of hours in the day of this date in the time zone. It may be more or less than 24 in the case of offset changes such as daylight saving time.

144
144
139
144

The inLeapYear accessor property of Temporal.ZonedDateTime instances returns a boolean indicating whether this date is in a leap year. A leap year is a year that has more days (due to a leap day or leap month) than a common year. It is calendar-dependent.

144
144
139
144

The microsecond accessor property of Temporal.ZonedDateTime instances returns an integer from 0 to 999 representing the microsecond (10-6 second) component of this time.

144
144
139
144

The millisecond accessor property of Temporal.ZonedDateTime instances returns an integer from 0 to 999 representing the millisecond (10-3 second) component of this time.

144
144
139
144

The minute accessor property of Temporal.ZonedDateTime instances returns an integer from 0 to 59 representing the minute component of this time.

144
144
139
144

The month accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the 1-based month index in the year of this date. The first month of this year is 1, and the last month is the Temporal/ZonedDateTime/monthsInYear. It is calendar-dependent.

144
144
139
144

The monthCode accessor property of Temporal.ZonedDateTime instances returns a calendar-specific string representing the month of this date. It is calendar-dependent.

144
144
139
144

The monthsInYear accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the number of months in the year of this date. It is calendar-dependent.

144
144
139
144

The nanosecond accessor property of Temporal.ZonedDateTime instances returns an integer from 0 to 999 representing the nanosecond (10-9 second) component of this time.

144
144
139
144

The offset accessor property of Temporal.ZonedDateTime instances returns a string representing the offset used to interpret the internal instant, in the form ±HH:mm (or ±HH:mm:ss.sssssssss with as much subminute precision as necessary). This offset is guaranteed to be valid for the given instant and time zone at construction time.

144
144
139
144

The offsetNanoseconds accessor property of Temporal.ZonedDateTime instances returns an integer representing the offset used to interpret the internal instant, as a number of nanoseconds (positive or negative). The value is a safe integer because it's less than a day, which is 8.64e15 nanoseconds.

144
144
139
144

The round() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing this date-time rounded to the given unit.

144
144
139
144

The second accessor property of Temporal.ZonedDateTime instances returns an integer from 0 to 59 representing the second component of this time.

144
144
139
144

The since() method of Temporal.ZonedDateTime instances returns a new Temporal.Duration object representing the duration from another date-time (in a form convertible by Temporal/ZonedDateTime/from) to this date-time. The duration is positive if the other date-time is before this date-time, and negative if after.

144
144
139
144

The startOfDay() method of Temporal.ZonedDateTime instances returns a Temporal.ZonedDateTime object representing the first instant of this date in the time zone. It usually has a time of 00:00:00, but may be different if the midnight doesn't exist due to offset changes, in which case the first time that exists is returned.

144
144
139
144

The subtract() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing this date-time moved backward by a given duration (in a form convertible by Temporal/Duration/from).

144
144
139
144

The timeZoneId accessor property of Temporal.ZonedDateTime instances returns a string representing the time zone identifier used to interpret the internal instant. The string is either a named identifier in the preferred case (such as "America/New_York"), or an offset in the form "±hh:mm". If the time zone has aliases, the timeZoneId is the identifier used…

144
144
139
144

The toInstant() method of Temporal.ZonedDateTime instances returns a new Temporal.Instant object representing the instant of this date-time.

144
144
139
144

The toJSON() method of Temporal.ZonedDateTime instances returns a string representing this date-time in the same RFC 9557 format as calling Temporal/ZonedDateTime/toString. It is intended to be implicitly called by JSON.stringify().

144
144
139
144

The toLocaleString() method of Temporal.ZonedDateTime instances returns a string with a language-sensitive representation of this date-time. In implementations with Intl.DateTimeFormat API support, this method delegates to Intl.DateTimeFormat and passes this date-time converted to a Temporal.Instant (because Intl.DateTimeFormat cannot directly format a…

144
144
139
144

The toPlainDate() method of Temporal.ZonedDateTime instances returns a new Temporal.PlainDate object representing the date portion of this date-time.

144
144
139
144

The toPlainDateTime() method of Temporal.ZonedDateTime instances returns a new Temporal.PlainDateTime object representing the date and time portions of this date-time. Only the time zone information is removed.

144
144
139
144

The toPlainTime() method of Temporal.ZonedDateTime instances returns a new Temporal.PlainTime object representing the time portion of this date-time.

144
144
139
144

The toString() method of Temporal.ZonedDateTime instances returns a string representing this date-time in the RFC 9557 format.

144
144
139
144

The until() method of Temporal.ZonedDateTime instances returns a new Temporal.Duration object representing the duration from this date-time to another date-time (in a form convertible by Temporal/ZonedDateTime/from). The duration is positive if the other date-time is after this date-time, and negative if before.

144
144
139
144

The valueOf() method of Temporal.ZonedDateTime instances throws a TypeError, which prevents Temporal.ZonedDateTime instances from being implicitly converted to primitives when used in arithmetic or comparison operations.

144
144
139
144

The weekOfYear accessor property of Temporal.ZonedDateTime instances returns a positive integer representing the 1-based week index in the Temporal/ZonedDateTime/yearOfWeek of this date, or undefined if the calendar does not have a well-defined week system. The first week of the year is 1. It is calendar-dependent.

144
144
139
144

The with() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing this date-time 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 date-time's fields.

144
144
139
144

The withCalendar() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing this date-time interpreted in the new calendar system. Because all Temporal objects are designed to be immutable, this method essentially functions as the setter for the date-time's Temporal/ZonedDateTime/calendarId property.

144
144
139
144

The withPlainTime() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing this date-time with the time part entirely replaced by the new time (in a form convertible by Temporal/PlainTime/from)

144
144
139
144

The withTimeZone() method of Temporal.ZonedDateTime instances returns a new Temporal.ZonedDateTime object representing the same instant as this date-time but in the new time zone. Because all Temporal objects are designed to be immutable, this method essentially functions as the setter for the date-time's Temporal/ZonedDateTime/timeZoneId property.

144
144
139
144

The year accessor property of Temporal.ZonedDateTime instances returns an integer representing the number of years of this date relative to the start of a calendar-specific epoch year. It is calendar-dependent.

144
144
139
144

The yearOfWeek accessor property of Temporal.ZonedDateTime instances returns an integer representing the year to be paired with the Temporal/ZonedDateTime/weekOfYear of this date, or undefined if the calendar does not have a well-defined week system. It is calendar-dependent.

144
144
139
144
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Experimental
  • Requires an experimental browser flag to be enabled
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Calendars `islamic`, `islamic-rgsa` and `islamic-umalqura` are not available. See bug 1950425 and bug 1954138.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Calendars `islamic`, `islamic-rgsa` and `islamic-umalqura` are not available. See bug 1950425 and bug 1954138.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Calendars `islamic`, `islamic-rgsa` and `islamic-umalqura` are not available. See bug 1950425 and bug 1954138.

Syntax

JAVASCRIPT
// Current date and time (with time zone)
const now = Temporal.Now.zonedDateTimeISO();

// Specific date
const date = Temporal.PlainDate.from('2026-04-06');
date.add({ days: 30 }); // 30 days later

// Time difference
const diff = date.until(Temporal.PlainDate.from('2026-12-31'));
diff.days; // 269

Live demo

Check Temporal support

Detect whether the Temporal global is available in the browser.

JavaScript
Output
Press the Run button

Create a plain date

Use Temporal.PlainDate when supported, otherwise report the missing API.

JavaScript
Output
Press the Run button

Add days immutably

Show how Temporal returns a new value instead of mutating the original one.

JavaScript
Output
Press the Run button

Use cases

  • Timezone-aware scheduling

    Represent local dates, exact instants, and user-facing time zones without mixing them accidentally.

  • Reliable calendar logic

    Build booking, reminders, and recurring schedules with clearer types than the old Date API provides.

Cautions

  • Temporal is broader than Date, so teams need to agree on which Temporal types map to which product concepts.
  • Migration from Date should be deliberate because mixed models can become confusing quickly.

Accessibility

  • Clearer date logic helps ensure schedules, deadlines, and reminders are presented accurately to all users.
  • Timezone-correct output is especially important when dates are read aloud by assistive technologies.

Powered by web-features