W3cubDocs

/JavaScript

Temporal.Instant()

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.

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

This constructor is exactly equivalent to calling Temporal.Instant.fromEpochNanoseconds().

Syntax

new Temporal.Instant(epochNanoseconds)

Note: Temporal.Instant() can only be constructed with new. Attempting to call it without new throws a TypeError.

Parameters

epochNanoseconds

A BigInt representing the number of nanoseconds since the Unix epoch.

Return value

A new Temporal.Instant object representing the instant in time specified by epochNanoseconds.

Exceptions

RangeError

Thrown if epochNanoseconds represents an instant outside the range of representable instants, which is ±108 days, or about ±273,972.6 years, from the Unix epoch.

Examples

>

Using Temporal.Instant()

const instant = new Temporal.Instant(0n);
console.log(instant.toString()); // 1970-01-01T00:00:00Z
const vostok1Liftoff = new Temporal.Instant(-275248380000000000n);
console.log(vostok1Liftoff.toString()); // 1961-04-12T06:07:00Z
const sts1Liftoff = new Temporal.Instant(355924804000000000n);
console.log(sts1Liftoff.toString()); // 1981-04-12T12:00:04Z

Specifications

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
Instant No No 139 No preview No 139 No No No No No ? 1.40 No

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/Instant/Instant