TypeScript
TypeScript copied to clipboard
Add Temporal (Stage 3) types
⚙ Compilation target
ESNext
⚙ Library
n/a
Missing / Incorrect Definition
-
Temporal -
Temporal.Now -
Temporal.Instant -
Temporal.ZonedDateTime -
Temporal.PlainDate,Temporal.PlainTime,Temporal.PlainDateTime -
Temporal.PlainYearMonth,Temporal.PlainMonthDay -
Temporal.Duration
Sample Code
const now = Temporal.Now.instant();
const past = Temporal.Instant.from('1969-07-20T20:17Z');
Documentation Link
https://tc39.es/proposal-temporal/docs/index.html
The API itself is quite stable. It is calendar that is blocking implementation.
FYI: Deno has implemented it quite long ago: Temporal - Web - Deno Docs
FYI Firefox is shipping Temporal in version 139, planned to be released at the end of May.
Firefox shipped the Temporal support and it has been out for a few months now. Would be great to get these types unless the condition for entering lib is cross-browser support, which it looks like we will have to wait a bit longer for:
https://caniuse.com/temporal