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
- spacetime – Zero Dependencies comment in the readme.
- Total: ~43KB
- luxon – 71KB, Everything is included, and it relies on the INTL api for locales.
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.