3 ms·
I'm a fan of Moment... it's served me well for most of a decade, including in some really heavy scheduling/timetable applications. The size of importing Moment
by noduerme 4y ago
I'm a fan of Moment... it's served me well for most of a decade, including in some really heavy scheduling/timetable applications. The size of importing Moment is really fairly negligible for a full-scale single page app. The one drawback I find with it is the overhead for creating new Moment objects. You never want to, for instance, run through a for/next loop of SQL dates and convert each into a Moment for sorting. If you must have them as Moments, you really need to cache once and compare later. Usually in my code I even avoid writing `new Moment()` within a control structure that only needs the current day or hour, and I set up an interval to run permanently in a utility class to just cache a recent Moment every 10 seconds or so, for comparison wherever else it's needed in the code.
That's the only real issue for me with Moment and I'm not sure this lib would change that... especially if I need to extend it for various uses every time it's called, which for me would be a rather large drawback that would end up polluting lots of modules with extra lines of code for specific date comparison purposes.
- Hendrikto 4y ago> The size of importing Moment is really fairly negligible. This attitude is why large parts of the Internet suck these days. I recently visited a friend in Kallithea, Athens, Greece. With his Internet connection, that would add about half a second. It‘s a typical speed for residential connections in Athens.
- noduerme 4y agoAgain, my context here is a large (1-2Mb) single page application. I wouldn't use a library like that in a static/informational webpage, and it's hard to think of a context where it would be necessary.