I was trying to format a date from ISO using date-fns library and it's giving the next day as the output.
format(new Date("2021-03-16T23:42:37Z"), "MMM do");
// Output: Mar 17th
I am expecting to get Mar 16. Can anyone please let me know what I'm doing wrong in here?
The trailing ‘Z’ is UTC but the Date instance gets created in your local time zone. 23:42 in UTC is after midnight where you are.