This content originally appeared on Bram.us and was authored by Bramus!
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 (e.g. 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
JavaScript Temporal API — A Fix for the Date API →
This content originally appeared on Bram.us and was authored by Bramus!
Bramus! | Sciencx (2021-04-14T21:57:25+00:00) JavaScript Temporal API — A Fix for the Date API. Retrieved from https://www.scien.cx/2021/04/14/javascript-temporal-api-a-fix-for-the-date-api-2/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.