You Don't Need MomentJS
github.com
github.com
https://github.com/you-dont-need/You-Dont-Need-Momentjs/raw/... https://github.com/you-dont-need/You-Dont-Need-Momentjs
There are still many situations where these alternative solutions will not work. For example timezones.
But in general pulling moment.js in for one method call is pretty ridiculous if it can be replaced and needs to be ran on the clientside.
This is the reason the web is fat, nay, morbidly obese. They solve problems for clients but they make the user experience suck, death by 1000 cuts/megs.
Bloat tends to originate from using way too many widgets/analytics coming from third-party domains.
> I'm tired of developers who value other developers based on if they use the latest hippest framework or not
The thing is most developers are actually pretty terrible at shipping product and so they judge each other purely on technical decisions, not business ones.
Libraries, especially MomentJS, take a TON of guesswork out of something that's incredibly complex: date/time. I use Moment for anything dealing with time on the front-end because it's almost universal at this point (other devs can support), it's a VERY mature/supported product, and I can just _trust it_ at this point.
People talking about bloat in regards to jQuery/Moment (or insert any JS library that's over 3 years) usually fail to mention things like CDNs, gzip, HTTP2, etc etc. Truth is, if you practice good hosting methods you can get the entirety of jQuery 3.4.x WAY beneath 100kb, to the tune of approx 35kb (last I checked).
Looks like I still need MomentJS
No uuid, no hashing, no zipping, no threading, limited random generation, super basic data structures...
So I have no hope for better date handling.
Then we get off by one dates when truncating the timestamp back down to just a date, when it happens in a different context than where the original timestamp ("date") was created and so falls on the wrong side of midnight, usually having gone through UTC in some intermediate system (if it didn't start there) with original context lost along the way. Had we really just wanted instants and not dates there would be no problem with that conversion, but a date is not an instant!
Timezones (there are way more than you think); daylight savings time (it's far more complex than you think); leap seconds; Logic around "is X plus 30 minutes after Y?" (you haven't considered every edge case).
Libraries in these contexts will save you from outages, bugs, etc. They've considered these edge cases. I primarily work in a Java world these days, and the java.time additions in Java 8 are (imho) more important than the Lambda additions. (And yes, there was Joda-time before, but the Joda author has explicitly said you should use java.time.)
So sure, if you're just getting the date in a specific format you can forgo MomentJS. But as soon as you start to want to do more things, maybe weigh in whether it's worth the size or not. That library is large because it contains a lot of important knowledge.
"You might not need jQuery" was reasonably useful, but that should have been it.
No need to turn everything into a meme.
I found it really useful, as I'm already very familiar with Moment, but am hesitant to use it on future projects where I only need a small fraction of its capabilities and don't want to inflate my bundle size.