Anyone who has worked with dates and time in JavaScript knows how broken the built-in Date
is. In the near future we’ll be able to use Temporal instead, an ECMAScript feature currently at Stage-3
💁♂️ Stage-3?
The Technical Committee which is concerned with the standardization of ECMAScript (i.e. TC39) has a 5 stage process in place, ranging from stage-0 to stage-4, by which it develops a new language feature.
Stage-3 is the Candidate Stage where the feature is considered complete and only critical changes will happen based on implementation experience. If all goes well the proposal will advance to Stage 4 without any changes, after which it will to become part of the ECMAScript Specification.
Nathan Sebhastian has a good overview on how it compares to Date, along with some practical examples.
The new
Temporal
API proposal is designed to solve the problems with theDate
API. It brings the following fixes to JavaScript date/time manipulation:
- Creating and dealing only with immutable
Temporal
objects- Straightforward API for date and time computations
- Support for all timezones
- Strict date parsing from ISO-8601 format
- Support for non-Gregorian calendars