Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@kamen
Industry is drifting away from moment due to its weight. Day.js, luxon, etc are the it things now. -
@SortOfTested I'm not a web dev so please forgive my ignorance, but are those third-party date libraries? Javascript needs third-party libraries for dates?!
And here I thought is-odd was silly... -
@EmberQuill
Like many languages, it has libraries for normalization, internationalization. Java has JodaTime, dotnet has nodatime, people have ported moment to golang, rust has chrono, etc etc. -
@SortOfTested I'm kind of surprised Moment was ported to golang. Doesn't seem to make things much easier than just using the built-in time package itself.
I'll admit that i got used to languages with good date/time implementations and forgot that there were plenty of bad ones aside from JS. -
@EmberQuill unfortunately, JS doesn't have everything related to dates out-of-the-box. It contains localized dates and even the rules that make them fit any locale. However, the things like relative date, timezones list and such require boilerplate code.
-
@SortOfTested Good point. Moment.js is not suitable for tree shaking, which only serves to bury it, unfortunately.
-
@EmberQuill
It's not a problem until it is most of the time. The libraries exist for improving usability of the API, fixing any underlying bugs and making complex date handling easier.
Most default datetime libraries are fine for working in a single time zone with no irregularities. Start adding in international and local convention, server-relative time adjustments, shifting, syncing and shit like India's 30-minute adjacent time zone and the libraries become a lot more valuable.
Decent partial list
https://gist.github.com/timvisee/... -
@SortOfTested I'm pretty sure "months start at 1" is a safe assumption in most languages though. Aside from Javascript or older, now-deprecated functions in other languages.
-
@EmberQuill
Sure, in gregorian support. The Hebrew, Hijri and Ethiopian calendars are a different story. -
kamen69934y@SortOfTested Fair enough, you might be right. I haven't had the need to use something like this in quite a while (if ever), I was just pointing to the idea of a library that normalises stuff.
-
@kamen Moment.js is no recommended by their maintainers now so not a good choice to recommend.
-
dder23234yGo watch computerphile’s (Tom Scott’s) video rant on timezones!
That being said, I’m so happy that moment exists!
Related Rants
-
sudo-woodo16Whatever the fuck Python's ternary operator syntax is supposed to be.
-
Root18Most hated language features? PL/SQL: • it exists XSLT: • it also exists PHP: • it still exists. VB:...
-
SortOfTested12Java: Primitive streams. Their need to exist is a monument to legacy failure. VB.net OrElse and AndAlso short...
All the stupid date functions where the days range from 1 to 31 but the months range from 0 to 11
rant
wk229