Temporal.ZonedDateTime() constructor
Baseline Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The Temporal.ZonedDateTime() constructor creates Temporal.ZonedDateTime objects.
This constructor allows you to create instances by directly supplying the underlying data. Like all other Temporal classes, you should usually construct Temporal.ZonedDateTime objects using the Temporal.ZonedDateTime.from() static method, which can handle a variety of input types.
Syntax
new Temporal.ZonedDateTime(epochNanoseconds, timeZone) new Temporal.ZonedDateTime(epochNanoseconds, timeZone, calendar)
Note: Temporal.ZonedDateTime() can only be constructed with new. Attempting to call it without new throws a TypeError.
Parameters
-
epochNanoseconds - A BigInt that corresponds to the
epochNanosecondsproperty. -
timeZone - A string that corresponds to the
timeZoneIdproperty. Unlike all otherTemporalAPIs, it must be a valid time zone identifier (either named or offset) as-is, and cannot be aTemporal.ZonedDateTimeinstance or a date-time string. -
calendarOptional - A string that corresponds to the
calendarIdproperty. SeeIntl.supportedValuesOf()for a list of commonly supported calendar types. Defaults to"iso8601".
Return value
A new Temporal.ZonedDateTime object, representing the specific instant specified by the parameters.
Exceptions
-
TypeError - Thrown if
timeZoneorcalendaris not a string. -
RangeError - Thrown in one of the following cases:
-
epochNanosecondsis not in the representable range, which is ±108 days, or about ±273,972.6 years, from the Unix epoch. -
timeZoneis not a valid time zone identifier. -
calendaris not a valid calendar identifier.
-
Examples
Using Temporal.ZonedDateTime()
const zdt = new Temporal.ZonedDateTime(0n, "America/New_York"); console.log(zdt.toString()); // '1969-12-31T19:00:00-05:00[America/New_York]'
Specifications
| Specification |
|---|
| Temporal # sec-temporal-zoneddatetime-constructor |
Browser compatibility
| Desktop | Mobile | Server | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on iOS | Samsung Internet | WebView Android | WebView on iOS | Bun | Deno | Node.js | |
ZonedDateTime |
No |
No |
139 |
No |
preview |
No |
139 |
No |
No |
No |
No |
No |
1.4.0 |
2.7 |
26.0.0 |
See also
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/ZonedDateTime/ZonedDateTime