DEV Community

Cover image for 4 alternatives to moment.js for internationalizing dates

4 alternatives to moment.js for internationalizing dates

Brian Neville-O'Neill on October 09, 2019

Written by Esteban Herrera✏️ Date formatting is one of the most important aspects when preparing an application to be used in different languages....
Collapse
 
johncarroll profile image
John Carroll

Version 2, the latest at the time of this writing, only comes in the form of an NPM package, so if you want to use it directly in a browser, you’ll have to use a bundler like Browserify.

FYI, you can use a tool like pika.dev to use many npm packages in the browser directly (like ‘date-fns’). E.g. this link works for ‘date-fns’ cdn.pika.dev/date-fans/v2

The only requirement is that the package provide a es6 module export (which, while not universal, is very common).

Another option is unpkg.com. There are likely more which I’m not aware of.

Collapse
 
bnevilleoneill profile image
Brian Neville-O'Neill
Collapse
 
johncarroll profile image
John Carroll

Ha! It's got to be a sign of success when strangers start advising you to use your own project! This being said, why didn't you mention it right there in the post 🤔?