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.
The Temporal.PlainDateTime() constructor creates Temporal.PlainDateTime objects.
This constructor allows you to create instances by directly supplying the underlying data. Like all other Temporal classes, you should usually construct Temporal.PlainDateTime objects using the Temporal.PlainDateTime.from() static method, which can handle a variety of input types.
new Temporal.PlainDateTime(year, month, day) new Temporal.PlainDateTime(year, month, day, hour) new Temporal.PlainDateTime(year, month, day, hour, minute) new Temporal.PlainDateTime(year, month, day, hour, minute, second) new Temporal.PlainDateTime(year, month, day, hour, minute, second, millisecond) new Temporal.PlainDateTime(year, month, day, hour, minute, second, millisecond, microsecond) new Temporal.PlainDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond) new Temporal.PlainDateTime(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond, calendar)
yearA number, truncated to an integer, representing the year in the ISO calendar system.
monthA number, truncated to an integer, representing the month in the ISO calendar system.
dayA number, truncated to an integer, representing the day of the month in the ISO calendar system.
hour OptionalA number, truncated to an integer, representing the hour component.
minute OptionalA number, truncated to an integer, representing the minute component.
second OptionalA number, truncated to an integer, representing the second component.
millisecond OptionalA number, truncated to an integer, representing the millisecond component.
microsecond OptionalA number, truncated to an integer, representing the microsecond component.
nanosecond OptionalA number, truncated to an integer, representing the nanosecond component.
calendar OptionalA string representing the calendar to use. See Intl.supportedValuesOf() for a list of commonly supported calendar types. Defaults to "iso8601". Note that irrespective of the calendar, the year, month, and day must be in the ISO 8601 calendar system.
A new Temporal.PlainDateTime object, representing the date-time specified by the parameters.
RangeErrorThrown in one of the following cases:
calendar is not a valid calendar identifier.const dt = new Temporal.PlainDateTime(2021, 7, 1); console.log(dt.toString()); // 2021-07-01T00:00:00 const dt2 = new Temporal.PlainDateTime(2021, 7, 1, 0, 0, 0, 0, 0, 0, "hebrew"); console.log(dt2.toString()); // 2021-07-01T00:00:00[u-ca=hebrew]
| Specification |
|---|
| Temporal> # sec-temporal-plaindatetime-constructor> |
| 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 | |
PlainDateTime |
No | No | 139 | No | No | No | 139 | No | No | No | No | No | ? | 1.40 | No |
© 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/PlainDateTime/PlainDateTime