Switch to infinite scroll (Full book)

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-30 or YYYY-MM-DD. It matches the Temporal's PlainDate.
    • time refers to components from hours to milliseconds (or even nanoseconds), e.g. 08:15:00.001 or HH:mm:ss.SSS. It matches the Temporal's PlainTime.

APIs

JavaScript offers severals ways to work with dates, time and durations:

  • The Date API
  • The Temporal API (ES2026)
  • The Intl API

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.

earlymorning logo

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-30 or YYYY-MM-DD. It matches the Temporal's PlainDate.
    • time refers to components from hours to milliseconds (or even nanoseconds), e.g. 08:15:00.001 or HH:mm:ss.SSS. It matches the Temporal's PlainTime.

APIs

JavaScript offers severals ways to work with dates, time and durations:

  • The Date API
  • The Temporal API (ES2026)
  • The Intl API

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.