Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

luxon

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

luxon

Immutable date wrapper

  • 1.11.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8M
decreased by-80.58%
Maintainers
1
Weekly downloads
 
Created

What is luxon?

Luxon is a powerful, modern, and friendly wrapper for JavaScript dates and times. It enables parsing, formatting, manipulation, and querying of dates and times in JavaScript.

What are luxon's main functionalities?

DateTime Manipulation

Luxon allows for easy manipulation of DateTime objects. You can add or subtract time units, and perform other modifications.

{"DateTime": require('luxon').DateTime; let now = DateTime.now(); let later = now.plus({ hours: 3 });}

Formatting Dates

With Luxon, you can format dates according to different patterns, making it easy to display dates in a user-friendly format.

{"DateTime": require('luxon').DateTime; let now = DateTime.now(); let formatted = now.toFormat('yyyy LLL dd');}

Parsing Dates

Luxon provides functions to parse dates from strings, including ISO 8601 formats, SQL dates, and more.

{"DateTime": require('luxon').DateTime; let dt = DateTime.fromISO('2020-05-15T08:30:00');}

Internationalization

Luxon supports internationalization, allowing dates to be displayed in different languages and formats based on locale settings.

{"DateTime": require('luxon').DateTime; let now = DateTime.now(); let localized = now.setLocale('fr').toLocaleString(DateTime.DATE_FULL);}

Querying and Comparison

You can use Luxon to compare dates and times, calculate durations between them, and query properties like how many days are between two dates.

{"DateTime": require('luxon').DateTime; let now = DateTime.now(); let christmas = DateTime.local(2023, 12, 25); let daysUntilChristmas = now.until(christmas).count('days');}

Other packages similar to luxon

Keywords

FAQs

Package last updated on 03 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc