I'm trying to go from moment.js to date-fns, but I'm having issues formatting the dates correctly..
My date looks like this: const convertDate = '2006-03-07T23:00:00.000Z'
I'm trying to convert it to: 2006-03-07
In moment.js I did it like this:
moment.utc(convertDate).format('YYYY-MM-DD')
--> 2006-03-07
In date-fns I tried to do it like this: format(new Date(convertDate), 'yyyy-MM-dd')
--> 2006-03-08
I have figured that I somehow need to convert my date to UTC before doing the formatting with date-fns, but it don't seems like this is possible? Any input on this?