DEV Community

loading...

Migrating away from moment.js

panayiotisgeorgiou profile image Panayiotis Georgiou Originally published at panayiotisgeorgiou.net on ・2 min read

Migrating away from moment.js

Moment.js was built for the previous era of the JavaScript ecosystem. The modern web looks much different these days. Moment’s usage is so widespread that it’s impossible to deprecate the current version over time. Check out this post on alternative options Migrating away from moment.js

And in alternative corner…

We started with recommendations from the moment deprecation guide and tossed in some fan favorites to make sure we made the best choice we could. Keep in mind that there was a time constraint, so we couldn’t examine every option. Here’s the list we compiled:

How to choose the correct one ?

It will always go down to project size !

  • moment – 327KB, but also needs moment-timezone (185KB)
    • Total: 513KB
  • date-fns – 37.3 KB, but also needs date-fns-timezone (2KB), and all locales (26 KB)
    • Total: ~64KB
    • Eliminated due to lack of pre-built bundle. We need a single source of truth for IWA, and did not want to have to maintain a build process.
  • day.js – 2KB, but also needs the utc and timezone plugins (4KB), and all locales (26 KB)
    • Total: ~32KB
  • spacetimeZero Dependencies comment in the readme.
    • Total: ~43KB
  • luxon – 71KB, Everything is included, and it relies on the INTL api for locales.

Follow me on Instagram

*That’s it for now. *

If you liked this article, then please subscribe to my YouTube Channel for video tutorials.

You can also find me on Twitter and Facebook.

The post Migrating away from moment.js appeared first on Panayiotis Georgiou.

Discussion (0)

Forem Open with the Forem app