DEV Community

Discussion on: date-fns: a moment.js alternative

Collapse
 
idoshamun profile image
Ido Shamun

Honestly, I don't like that I have to create a custom object like in moment or dayjs (as you shown) to use the library. I prefer a set of functions that I can immediately apply on every date object.
This is exactly date-fns approach. They provide you functions not objects.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Only that there is no piping in JavaScript (I think).

Thread Thread
 
idoshamun profile image
Ido Shamun

What do you mean?

Thread Thread
 
patarapolw profile image
Pacharapol Withayasakpunt

|> or %>%. I know it is only for the sake of convenience, though.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Now, I have to wonder. Is JavaScript Date object good enough?

Can it validate 2020-13-32, or is it browser dependent?

stackoverflow.com/questions/744532...