PACKAGE · DATE & TIME

luxon

Immutable date wrapper

WEEKLY DOWNLOADS 60.1M
STARS 16.5K
FORKS 818
OPEN ISSUES 225
GZIP SIZE 22.3 kB
UNPACKED SIZE 4.6 MB
DEPENDENCIES 1
LAST UPDATED 1y ago
DOWNLOAD TRENDS

luxon downloads · last 12 months

Download trends for luxon1 download series from Nov 2025 to Oct 2026. Use left and right arrow keys to inspect monthly values.050.2M100.3M150.5M200.6MNov 2025FebMayAugOct 2026
luxon
ABOUT LUXON

Luxon is an immutable date and time library for JavaScript that provides a structured way to create, inspect, modify, and format date-time values. It addresses common problems with native date handling, especially working with time zones, localized output, and date arithmetic without repeatedly changing a shared mutable object.

Its design centers on immutable values and internationalization capabilities, making it suitable for developers who need predictable date-time operations across locales and time zones. Luxon is aimed at application code that must represent more than a timestamp, such as a local calendar date, a zoned time, or a duration, while keeping transformations explicit.

The API is organized around types such as `DateTime`, `Duration`, and `Interval`. Create values with `DateTime` factory methods, use methods such as `setZone` to work with a time zone, and format output with methods such as `toLocaleString`; operations return values rather than mutating the original. This pattern makes it practical to chain calculations and keep input, intermediate, and display values distinct.

Luxon fits JavaScript and TypeScript application workflows that need date handling in browser or server code, including interfaces that display localized dates and services that process time-zone-aware values. Its use of internationalization APIs supports locale-sensitive formatting, while its date-time abstractions can be used independently of a particular UI framework or application architecture.

The supplied package details list version 3.7.2, an MIT license, 16.2 million weekly downloads, 16.5K GitHub stars, and 805 forks. The listed gzip bundle size is 22.3 kB, which is a relevant trade-off for browser applications; the unpacked size is 4.6 MB. The project also lists 202 open issues and a last-updated date of 2026-08-09, so teams should review its current maintenance status and bundle impact against their requirements.

Luxon does not remove the need to make date-time semantics explicit: a calendar date, a UTC instant, and a local time in a named zone are different kinds of values. Confirm how input strings, zones, and locale settings should be interpreted, and test daylight-saving transitions and boundary cases that matter to the application.

WHEN TO USE
  • Use `DateTime` when application code needs immutable date-time values and transformations that leave the original value unchanged.
  • Use `setZone` when displaying or calculating times in a specified time zone rather than relying on the runtime's default zone.
  • Use `toLocaleString` when dates and times should be formatted for a chosen locale with internationalization support.
  • Use `Duration` when representing and manipulating an amount of elapsed time separately from a calendar date.
  • Use `Interval` when code needs to represent a span between date-time values and perform interval-oriented operations.
  • Use Luxon in browser or server-side JavaScript workflows that share date-time logic without tying it to a particular UI framework.
  • Consider it for applications where immutable operations help keep source values, intermediate calculations, and formatted display values distinct.
WHEN NOT TO USE
  • Avoid Luxon if the required browser bundle budget cannot accommodate the listed 22.3 kB gzip size; use native date handling or a lighter date-time approach that meets the needed features.
  • Avoid it when the task is limited to storing or comparing Unix timestamps and no calendar, locale, or time-zone operations are required; keep the values numeric and convert only for display.
  • Avoid it when the application needs a domain-specific calendar or date model not covered by the date-time abstractions you require; use a model designed for that calendar.
  • Avoid relying on Luxon formatting alone when output must follow a fixed, externally defined string format rather than locale-sensitive presentation; implement and test that format explicitly.
  • Avoid treating local times as unambiguous instants when time-zone and daylight-saving rules affect the result; define the zone and input interpretation explicitly, or use a data model that preserves those distinctions.
  • Avoid adding Luxon solely for a single basic date display if native internationalization APIs already satisfy the formatting requirement; use those APIs to reduce dependency and bundle overhead.

CORRECTIONS

Spot wrong data here?

A short note helps us fix it.

Anonymous · No account · No email back

COMPARISONS 5
luxon vs date-fns ★ 36.7K · 123.1M/wk luxon vs moment ★ 47.9K · 51.4M/wk luxon vs dayjs ★ 48.6K · 114.1M/wk luxon vs @formkit/tempo ★ 2.6K · 125.3K/wk luxon vs @js-joda/core ★ 1.7K · 7.9M/wk