Overview

Luxon is a JavaScript library for working with dates and times, developed by the creators of Moment.js. It offers a modern, immutable API that contrasts with the mutable approach of its predecessor, providing a more consistent and predictable experience for developers. Luxon instances are immutable, meaning that any operation that transforms a date or time object, such as adding days or changing the timezone, returns a new Luxon object rather than modifying the original. This design choice helps prevent unexpected side effects and simplifies state management, particularly in complex applications where date objects might be passed around or stored in shared state.

The library is built to address contemporary JavaScript development needs, including robust support for the ECMAScript Internationalization API (Intl object). This integration allows Luxon to handle a wide range of locale-specific date and time formatting, parsing, and timezone operations with precision. For example, Luxon can format dates according to specific regional conventions, display time in a user's local timezone, or convert between timezones while accounting for daylight saving time rules. This makes Luxon particularly well-suited for applications targeting a global audience, where accurate display and manipulation of localized date and time information are essential for user experience.

Luxon is designed for scenarios requiring precise timezone control and internationalization. It supports a comprehensive set of date and time units, from milliseconds to years, and provides methods for calculation, comparison, and formatting. Developers can parse dates from various input formats, including ISO 8601 strings, JavaScript Date objects, or custom patterns. Its API is chainable, allowing for expressive and concise code when performing multiple operations on a date object. The library's focus on immutability and native internationalization capabilities positions it as a reliable choice for building modern web applications, Node.js services, or even React Native applications where date and time accuracy and global adaptability are paramount.

While Moment.js was widely adopted, its mutable nature and large bundle size became concerns for modern JavaScript development. Luxon was created to offer a better alternative, providing a smaller footprint and an immutable API that aligns with functional programming paradigms. It avoids direct manipulation of the native Date object where possible, instead preferring its own internal representation to manage complexity and ensure consistency across different environments. This approach also integrates well with modern JavaScript module systems, allowing for tree-shaking and potentially smaller application bundles when only specific parts of the library are used.

Key features

  • Immutable Objects: All operations return new Luxon instances, ensuring original date/time objects are never modified, which helps prevent side effects and simplifies debugging.
  • Comprehensive Timezone Support: Built-in capabilities for parsing, displaying, and converting dates and times across various timezones, including handling daylight saving time transitions accurately.
  • Internationalization (I18n): Leverages the native Intl object for locale-specific formatting, parsing, and relative time calculations, supporting a wide array of languages and regional conventions.
  • Rich API for Date/Time Manipulation: Provides methods for adding, subtracting, diffing, and comparing dates and times with various units (years, months, days, hours, minutes, seconds, milliseconds).
  • Flexible Parsing and Formatting: Supports parsing dates from multiple formats (ISO 8601, custom strings, JavaScript Date objects) and formatting them into locale-specific or custom string representations.
  • Intervals and Durations: Offers distinct objects for representing time intervals between two dates and durations of time, facilitating complex temporal calculations.
  • Chainable API: Methods can be chained together for concise and readable code when performing multiple operations on a single date/time object.
  • Browser and Node.js Compatibility: Designed to work seamlessly in both client-side browser environments and server-side Node.js applications.

Pricing

As of May 4, 2026, Luxon is an open-source library and is available for use free of charge. There are no licensing fees, subscriptions, or paid tiers associated with its use or distribution.

Tier Cost Features
Open Source Free Full access to all Luxon features, including immutable date/time objects, timezone conversions, internationalization, and a comprehensive API for date manipulation.

For detailed information about the project and its open-source license, refer to the Luxon project homepage.

Common integrations

Luxon integrates well into various JavaScript environments and frameworks due to its pure JavaScript nature and focus on standard date/time operations. While it doesn't have a specific list of third-party integrations in the way a SaaS product might, it is commonly used:

  • Web Applications (React, Vue, Angular, Svelte): Luxon can be used within any modern JavaScript framework to manage and display dates and times in UI components. Developers can integrate Luxon for user input parsing, localized display, and backend API data processing within React applications for state management, Vue.js for computed properties, or Angular for data binding.
  • Node.js Backend Services: For server-side applications, Luxon handles date/time logic, such as timestamp processing, scheduling tasks, or converting historical data to different timezones. It's compatible with frameworks like Express.js for API route handling or NestJS for robust server architecture.
  • React Native Applications: Luxon can be used in mobile applications built with React Native for consistent date and time handling across platforms, ensuring that dates are displayed correctly according to the device's locale and timezone settings, as described in the React Native environment setup guide.
  • Data Processing Scripts: In scripts that process and transform data, Luxon provides reliable tools for parsing, manipulating, and formatting date and time strings from various sources.

Alternatives

  • date-fns: A modular JavaScript date utility library providing a comprehensive set of functions for manipulating dates, designed for immutability and tree-shaking.
  • Day.js: A minimalist JavaScript library that parses, validates, manipulates, and displays dates, featuring a Moment.js-like API but with a significantly smaller bundle size.
  • Moment.js: A well-established JavaScript date library known for its powerful parsing, validation, manipulation, and display capabilities, though it uses mutable date objects.
  • Native JavaScript Date Object: The built-in Date object in JavaScript offers basic date and time functionality, but it lacks advanced features like robust timezone handling and immutable operations.

Getting started

To begin using Luxon, you first need to install it in your JavaScript project. Luxon is available via npm, the package manager for JavaScript. Once installed, you can import and use its core classes, such as DateTime, to create and manipulate date and time objects.

Installation

Open your terminal or command prompt in your project directory and run the following command:

npm install luxon

Or, if you prefer using Yarn:

yarn add luxon

Basic Usage Example

After installation, you can import DateTime and start working with dates. The following example demonstrates how to create a current date/time object, format it, and perform a simple manipulation like adding days. This code snippet illustrates creating a DateTime object representing the current moment, formatting it into a human-readable string for display, and then calculating a future date by adding a specific number of days, showcasing Luxon's immutable API where plus() returns a new object.

import { DateTime } from 'luxon';

// Create a DateTime object for the current moment
const now = DateTime.now();
console.log('Current Date and Time:', now.toString());

// Format the date/time for display
// For example, 'Monday, May 4, 2026 at 10:30 AM'
const formattedDate = now.toLocaleString(DateTime.DATETIME_FULL);
console.log('Formatted Date:', formattedDate);

// Add 7 days to the current date (returns a new DateTime object)
const futureDate = now.plus({ days: 7 });
console.log('Date 7 days from now:', futureDate.toLocaleString(DateTime.DATE_FULL));

// Convert to a specific timezone
const londonTime = now.setZone('Europe/London');
console.log('Current time in London:', londonTime.toLocaleString(DateTime.DATETIME_FULL));

// Parse a date string
const parsedDate = DateTime.fromISO('2025-10-26T14:30:00', { zone: 'America/New_York' });
console.log('Parsed Date in New York:', parsedDate.toLocaleString(DateTime.DATETIME_FULL));

This example demonstrates key aspects of Luxon: creating DateTime instances, formatting them using locale-aware methods, performing immutable transformations like adding time units, and handling timezone conversions. The toLocaleString method relies on the browser's or Node.js's native Intl API for accurate, locale-specific output, as detailed in the MDN Web Docs on the Intl object.