To use the parseISO() function from the date-fns library in TypeScript, you'll first need to install the date-fns library and its type definitions:
60 chars3 lines
Next, you can import the parseISO() function from the date-fns library and use it like this:
index.ts221 chars6 lines
In the code above, we import the parseISO() function from the date-fns library and use it to parse an ISO date string 2020-10-01T07:30:00.000Z
. The function returns a JavaScript Date object that we store in the date
variable.
Finally, we log the date
object to the console, which outputs the date in the local timezone.
gistlibby LogSnag