Overview
terminology
- An instant is a point in time. We sometimes use the term timestamp.
- A duration is a quantity of time, and a distance between two instants.
- In the context of calendar components, date and time have specific meaning:
- date refers to calendar components from year to day (year, month and day), e.g.
2026-06-30orYYYY-MM-DD. It matches the Temporal's PlainDate. - time refers to components from hours to milliseconds (or even nanoseconds), e.g.
08:15:00.001orHH:mm:ss.SSS. It matches the Temporal's PlainTime.
- date refers to calendar components from year to day (year, month and day), e.g.
APIs
JavaScript offers severals ways to work with dates, time and durations:
- The
DateAPI - The
TemporalAPI (ES2026) - The
IntlAPI
libraries
In this book, we cover the Luxon library as it supports time zones whereas JS Date doesn't. Luxon also provides formatting capabilities that neither Date and Temporal provide.