Skip to content
main
Go to file
Code

Latest commit

Without 'weeks' listed in the unsupported units, adding a number of
weeks to a Temporal.Absolute would just return a new object with the
same timestamp. Instead, disallow arithmetic with weeks, as they are
calendar-dependent.
ea237d1

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Temporal

Provides standard objects and functions for working with dates and times.

NOTE: The Polyfill, specification text and documentation are under continuing development and should be understood to be unstable.

Champions

Status

This proposal is currently stage 2.

Stage 3 Reviewers:

  • Richard Gibson
  • Bradley Farias
  • Daniel Ehrenberg

Overview / Motivation

Date has been a long-standing pain point in ECMAScript. This proposes Temporal, a global Object that acts as a top-level namespace (like Math), that brings a modern date/time API to the ECMAScript language. For a detailed breakdown of motivations, see: Fixing JavaScript Date

Principles:

  • All Temporal objects are immutable.
  • Date values can be represented in local calendar systems, but they should be convertable to and from the Proleptic Gregorian Calendar.
  • All time-of-day values are based on a standard 24-hour clock.
  • Leap seconds are not represented.

Specification Text

The specification text can be found here.

Polyfill

A complete polyfill can be found here. When viewing the reference documentation, the polyfill is automatically loaded in your browser, so you can try it out by opening your browser's developer tools.

NOTE: We encourage you to experiment with the polyfill, but don't use it in production! The API will change before the proposal reaches Stage 3, based on feedback that we receive during this time. Please give us your feedback in the issue tracker and by taking the survey. More info: https://blogs.igalia.com/compilers/2020/06/23/dates-and-times-in-javascript/

Documentation

Reference documentation and examples can be found here.

A cookbook to help you get started and learn the ins and outs of Temporal is available here

You can’t perform that action at this time.