JavaScript github.com

You probably don't need Moment.js

When you pull in a library dependency, it is rare that you need all of the functionality it offers. This isn’t usually a problem for backends, because that code never leaves the server. However, In frontend-land your users pay the price for all that unused functionality every time they hit your website with a cold cache.

Moment.js is an excellent date/time library. It is packed with functionality, and you probably don’t need everything it has to offer. Instead, check out date-fns, which offers small, highly targeted functions you can probably get by with. There’s even an ESLint plugin that will help you identify places in your codebase where you don’t really need Moment.js!


No comments

Sign in or join to comment

0:00 / 0:00