4 ms·
You don't need date libraries at all: https://github.com/you-dont-need/You-Dont-Need-Momentjs https://github.com/you-dont-need/You-Dont-Need-Momentjs
by galoisgirl 7y ago
You don't need date libraries at all: https://github.com/you-dont-need/You-Dont-Need-Momentjs https://github.com/you-dont-need/You-Dont-Need-Momentjs
- enobrev 7y agoIf anything, the examples here show why a date library may be worthwhile. There are definitely some examples with the native Date class does a great job, but some of those native examples are awful.
- tlarkworthy 7y agoSeems out of date, gziped moment.min.js is only 16.7kb (https://momentjs.com/ https://momentjs.com/), which invalidates the main thrust of the argument (i.e. moment is too big).
- Cthulhu_ 7y agoThat's the basic version without locales though, which is what the original subject is about; you need the locales to format a date in a certain locale. With locales it's 67.8K gzipped, over 500KB uncompressed - that's half a MB of Javascript you're asking your browsers to interpret as well.
- untog 7y ago16.7kb is still too large if you’re not using it enough to justify the extra download. And given that size doesn’t contain locales, in this context it isn’t going to serve any useful purpose at all.
- dragonwriter 7y agoThat mostly talks about using other date libraries instead of momentjs, not that you don't need date libraries. Yes, obviously you can forego DRY and write and maintain a bunch of boilerplate for date manipulation, or write and maintain your own date library, but for most uses itmakes a lot more sense to use an existing library. For new uses, probably not momentjs, though—probably date-fns, or luxon, or...