Quick Look – Luxon

In JavaScript projects, we have been using MomentJS for a lot of the date math that happens in much of the business software we write. The MomentJS team is pushing for Luxon as the replacement.

To get started with Luxon, you need to install it with npm.

npm install luxon

Luxon works a lot like you would expect. You have a DateTime class that can be used to represent a date and/or time. Many of the common DateTime functions you would expect exist with this class.

Luxon is a fresh attempt at a JS library to handle dates and times. This seems like it should be a very solvable problem, but dates and times are more challenging than you would think, especially when you factor in time zones. Luxon tries to rely on the browser to help more with this problem. This hopefully creates a better product with less code.

The Luxon library has a good walk-through. Their docs, in general, seem pretty good.

If you need a sound JS library to support Date and Times in JS, give Luxon a try.

Related posts