5 ms·
I have not used moment.js or other date libraries in a long while. But how does this compare to Luxon? (https://moment.github.io/luxon/#/why https://moment.gith
by Nican 4y ago
I have not used moment.js or other date libraries in a long while.
But how does this compare to Luxon? (https://moment.github.io/luxon/#/why https://moment.github.io/luxon/#/why)
- zebracanevra 4y agoDayjs is 2kb. That library is 70kb+. Dayjs has the familiar momentjs API. Both libraries have the greatest differentiating feature from moment: immutable objects. Being able to compose dayjs objects together without fear of modifying them afterwards makes everything a breeze.
- _fat_santa 4y agoFull disclosure I haven't used Luxon nearly as much as I've used DayJS, but I would say IMO DayJS is way simpler and more intuitive, this is a very small thing but for example, why would they format Months, by "L" instead of by "M"? The other reason I like DayJS over Luxon is the sheer number of plugins you can pull in to do various things. Like for example I was building an application where I had to build a weekly calendar form for a timesheet, the requirement was weeks start on Saturday and end of Friday. In DayJS I was able to do this pretty easily by doing: dayjs().startOf('week').subtract(1, 'day') to get the start and then took the result and did res.add(6, 'days') to get the end. I'm not sure if Luxon has this type of functionality. Lastly I like the plugin architecture rather than giving you everything up front. By default DayJS does not include any of those cool transformations like I talked about above, you have to pull them in as plugins from DayJS, this results in a bit more setup but smaller bundle sizes at the end of the day.
- icambron 4y agoIn Luxon that is dt.startOf(“week”).plus({ days : 6 })
- Mogzol 4y ago> why would they format Months, by "L" instead of by "M" "M" is used for months in Luxon, and is usually what you should use. "L" is only for standalone months, i.e. not within a date string, usually not what you want. In English these are the same thing, but in some languages they are different. https://github.com/moment/luxon/blob/master/docs/formatting.md#standalone-vs-format-tokens https://github.com/moment/luxon/blob/master/docs/formatting....
- blahyawnblah 4y agoLuxon is my preferred library
- 9wzYQbTYsAIc 4y agoBut how does this compare to Luxon, besides it being the preferred library of blahyawnblah?
- spoils19 4y agoI don't think there's any need to be condescending.
- 867-5309 4y agoit's actually their username
- deleted 4y ago[deleted]
- croes 4y agohttps://terodox.tech/migrating-away-from-momentjs-part1/ https://terodox.tech/migrating-away-from-momentjs-part1/
- Semaphor 4y agoSummary: day.js had DST bugs, luxon did not.
- 9wzYQbTYsAIc 4y ago> luxon - 71KB, Everything is included, and it relies on the INTL api for locales. Interesting, Luxon seems to be the only library in that article using Intl [1] for locales [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...