Interesting to see the support for luxon. When moment was announced as a done project they recommend a number of alternatives; one of those was luxon. Date-fns was also in there, and given I was already using it I carried on my merry way! I'm curious what the difference between luxon and date-fns is. Npm trends are interesting https://npmtrends.com/date-fns-vs-dayjs-vs-luxon-vs-moment
Day.js – Fast 2kB alternative to Moment.js with the same modern API
101–110 of 141 posts
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#102What is the obsession with xKB? With tracking, analytics, monitoring and gazillion other scripts, I'd wager that an average webpage size is probably closer to 1MB. Checked some of the popular sites (caching enabled)- Amazon.com - 4.8MB Google.com - 2.5MB
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#103Earlier quoted context omitted.
Smaller bundle size, similarity to moment.js As a dev who’s used all three, is there a massive difference? Not really. Stick with what you like (though moment is no longer maintained so maybe not that)
Moment is still being maintained, but will not receive any new features.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#104If you are considering switching to a (different) date library, I would suggest to hold off. ECMAScript is about to introduce a native date and time API that is much better than the current Date functionality. It may also make the need for a third-party date library obsolete (as long as you do not need to parse custom date formats). - https://github.com/tc39/proposal-temporal - https://github.com/tc39/proposal-tempor…
you don't need to hold off - you just wrap the library in an api of your own, specific for your usage. Then, when/if the ecmascript standard library adds a good one in, you just need to re-implement the wrapper, which would be presumably pretty easy as the api surface area is fairly small.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#105Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#106Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#107If you are considering switching to a (different) date library, I would suggest to hold off. ECMAScript is about to introduce a native date and time API that is much better than the current Date functionality. It may also make the need for a third-party date library obsolete (as long as you do not need to parse custom date formats). - https://github.com/tc39/proposal-temporal - https://github.com/tc39/proposal-tempor…
> I would suggest to hold off you don't need to hold off - you just wrap the library in an api of your own, specific for your usage. Then, when/if the ecmascript standard library adds a good one in, you just need to re-implement the wrapper, which would be presumably pretty easy as the api surface area is fairly small.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#108See https://medium.com/rise-engineering/how-we-managed-to-shed-3... for an example. Takes Moment.js from 364KB to 59KB. Still much larger than 2KB, but perhaps small enough.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#109Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#110Moment.js gets a lot smaller if you apply the same trick Day.js is using here, that is, to just load the locales that you need. See https://medium.com/rise-engineering/how-we-managed-to-shed-3... for an example. Takes Moment.js from 364KB to 59KB. Still much larger than 2KB, but perhaps small enough.