I'm using date-fns I would like to convert new Date(2020,1,10) to 'Thursday'. I'm trying to use
dateFns.format(new Date(2020,1,10),'dddd')
but it returns 0001?
Thanks in advance
I'm using date-fns I would like to convert new Date(2020,1,10) to 'Thursday'. I'm trying to use
dateFns.format(new Date(2020,1,10),'dddd')
but it returns 0001?
Thanks in advance
For me using date ("2022-10-29")
and format(new Date(date), 'EEEE')
showed wrong weekday Friday instead of Saturday (I am Central Time), from my understanding I need to provide time to get correct weekday.
for some reason this using different "Month Day, Year" format this worked: {format(parseISO(date), "MMMM d, yyyy")}
=> October 29, 2022
Since I had time in different variable, I have combined, date and time {format(new Date(date + "T" + time + "Z"), "EEEE")}
this seem to work, shows correct weekday: Saturday
Use this for full Day name: