Live data from Hacker News

Day.js – Fast 2kB alternative to Moment.js with the same modern API

day.js.org

11–20 of 141 posts

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#11
post #7

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 )

Luxon is my preferred library

But how does this compare to Luxon, besides it being the preferred library of blahyawnblah?

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#12
post #3

Why is this good/better compared to date-fns?

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

#13

Earlier quoted context omitted.

Luxon is my preferred library

But how does this compare to Luxon, besides it being the preferred library of blahyawnblah?

https://terodox.tech/migrating-away-from-momentjs-part1/

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#14
post #13

Earlier quoted context omitted.

But how does this compare to Luxon, besides it being the preferred library of blahyawnblah?

https://terodox.tech/migrating-away-from-momentjs-part1/

> 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/Refe...

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#15

It's embarrassing we never evolved the date api which comes with the browser. That said, I tend to err on writing a custom function / importing only a custom function over importing an entire library just to run a 2 lines function.

The new Temporal API in JS is precisely that.

Yeah, but that’s been just a proposal for a long time. Getting new features in JS takes forever.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#18

Earlier quoted context omitted.

The new Temporal API in JS is precisely that.

Yeah, but that’s been just a proposal for a long time. Getting new features in JS takes forever.

> just a proposal

It’s literally final pending commitments from/to another standards body. If they hadn’t made that commitment there’d be people chastising them for something else. I swear to fuck, we can’t have nice things because no one will ever accept having nice things.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#19

It's embarrassing we never evolved the date api which comes with the browser. That said, I tend to err on writing a custom function / importing only a custom function over importing an entire library just to run a 2 lines function.

The new Temporal API in JS is precisely that.

Looks a bit like JS-Joda.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#20
post #7

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 )

Dayjs 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.

Post reply on HN