-
I have
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yeah,
import { format, parseISO } from "date-fns";
console.log(format(parseISO("2021-11-01"), "MM/dd/yyyy")); // 11/01/2021
console.log(format(new Date(2021, 10, 1), "MM/dd/yyyy")); // 11/01/2021 |
Beta Was this translation helpful? Give feedback.
Yeah,
date-fns
works with local time zones only at the moment. The problem is you're passing strings in the JS Date constructor which treats the input as UTC, but thedate-fns
functions work on local time zone representations of the date.