PLEASE use joda-js on Javascript: https://js-joda.github.io/js-joda/ It's a port of the java8 date/time API, which is the most correct date-handling library there is.
What if one does not want to use a port of Joda? Even looking at the documentation makes me run away. Where are all the examples? date-fns seems good, moment works well too, despite its flaws, this new one is worth looking at. Dismissing all other libraries isn't very helpful. And yes, I realise all other libraries are wrappers around Date. It works well enough for 99% of cases.
Luxon – A library for working with dates and times in JS
21–30 of 80 posts
Re: Luxon – A library for working with dates and times in JS
#22Earlier quoted context omitted.
What if one does not want to use a port of Joda? Even looking at the documentation makes me run away. Where are all the examples? date-fns seems good, moment works well too, despite its flaws, this new one is worth looking at. Dismissing all other libraries isn't very helpful. And yes, I realise all other libraries are wrappers around Date. It works well enough for 99% of cases.
Agree with your points, but I really thought joda-time’s documentation was decent! Cheatsheet had plenty of examples: https://js-joda.github.io/js-joda/cheat-sheet.html
Re: Luxon – A library for working with dates and times in JS
#23How does it compare to date-fns?
Re: Luxon – A library for working with dates and times in JS
#24Months in Luxon are 1-indexed instead of 0-indexed like in Moment and the native Date type. This seems like a bold decision and terrifying source of errors for those of us with decades of experience thinking January is 0.
Re: Luxon – A library for working with dates and times in JS
#25I've migrated a lot of code from moment to date-fns because of moment's bulky size and vast, mutable API. Luxon seems to fix the API issue. date-fns is still great for simple operations, but I'll definitely consider this for new projects with nontrivial datetime handling.
Edit: wow, I just looked at the repo and realized its made by the Moment team. That might be pretty cool.
Re: Luxon – A library for working with dates and times in JS
#26Going just by the one example there, I can see that timezone by location is probably extra, that's perfectly fine. The endOf modifier seems more like a helper to fix broken date/time model in js? But other parts should probably be in the standard library? I was under the impression js is improving fast nowadays, will stuff like this get into the language?
Re: Luxon – A library for working with dates and times in JS
#27Earlier quoted context omitted.
What if one does not want to use a port of Joda? Even looking at the documentation makes me run away. Where are all the examples? date-fns seems good, moment works well too, despite its flaws, this new one is worth looking at. Dismissing all other libraries isn't very helpful. And yes, I realise all other libraries are wrappers around Date. It works well enough for 99% of cases.
https://js-joda.github.io/js-joda/cheat-sheet.html EDIT: My precious internet points! ;) - wait, is this not a page of examples, as linked to from the GitHub page?
Re: Luxon – A library for working with dates and times in JS
#28Sorry for the dumb questions, I haven't worked with js much, but what does this add to the standard library? Going just by the one example there, I can see that timezone by location is probably extra, that's perfectly fine. The endOf modifier seems more like a helper to fix broken date/time model in js? But other parts should probably be in the standard library? I was under the impression js is improving fast nowaday…
As for what it adds, looks like duration and interval classes.
Re: Luxon – A library for working with dates and times in JS
#29Re: Luxon – A library for working with dates and times in JS
#30How does this compare in file size to Moment? That's the only real issue I have with it.
If you only want timezone conversions I removed everything else from Moment. It's less than 2KB uncompressed: https://github.com/scorredoira/timezone.js