Any recommendation on a Date parser?

I just noticed that the use of Js.Date.fromString is discouraged since it uses the Date constructor.
I’m curious if you guy have any recommendation of a lightweight date parser

The simple solution is to make sure you have ISO formatted timestamp strings, or a unix timestamp number, and use fromString.

Failing that your best option is probably to use date-fns

It’s completely tree-shakeable and bindings should be really trivial to write.

Soon the Temporal API will start shipping, just note that the API isn’t 100% stable yet. You could ship a polyfill for that, I have some WIP bindings here if you want to use them

3 Likes

date-fns looks pretty good, thanks

1 Like