News for hackers. Stuff that matters.
Re:You don't need libraries for internationalization of dates by fake-name on Thursday February 20, 2020 @04:38AM (#22373861)
(In javascript, because you can standard library).

So yes, you do.

Re:You don't need libraries for internationalization of dates by Jonnax on Thursday February 20, 2020 @05:21AM (#22374032)
Normally when people say library they don't mean the built in libraries for a language but external packages.
Re:You don't need libraries for internationalization of dates by sshine on Thursday February 20, 2020 @05:29AM (#22374064)
Still, the title is overselling the post.
Re:You don't need libraries for internationalization of dates by virtue3 on Thursday February 20, 2020 @05:08AM (#22373975)
also, for the love of God, if you do any sort of date manipulation, just suck it up and use moment.
Re:You don't need libraries for internationalization of dates by enlyth on Thursday February 20, 2020 @06:40AM (#22374351)
Moment is huge, its performance sucks and the mutability makes developers shoot themselves in the foot constantly. Trust me there are much better alternatives.
Re:You don't need libraries for internationalization of dates by villek on Thursday February 20, 2020 @05:41AM (#22374115)
I recently replaced moment (which is huge like others mentioned) with luxon (https://moment.github.io/luxon/). It has pretty much all the same functionality but a way smaller size.
Re:You don't need libraries for internationalization of dates by untog on Thursday February 20, 2020 @07:28AM (#22374574)
For the love of God if you’re in the browser don’t use moment. It’s bulky and slow. Use date-fns and selectively import the functionality you’re actually using.
Re:You don't need libraries for internationalization of dates by yen223 on Thursday February 20, 2020 @03:15PM (#22378157)
Note that date-fns right now doesn't have great support for duration calculations: https://github.com/date-fns/date-fns/issues/284

I wound up switching to Luxon because of this. Which is too bad, because date-fns is a fine library otherwise.

Re:You don't need libraries for internationalization of dates by Aeolun on Thursday February 20, 2020 @05:12AM (#22373992)
Moment is huge though.
Re:You don't need libraries for internationalization of dates by jamwaffles on Thursday February 20, 2020 @05:29AM (#22374065)
I've used date-fns (https://date-fns.org/) with good success. The import structure allows for pretty good tree shaking. It's really good if you only want to format a date in like 2 places in a huge app - don't need to pull in the entire library for that.