You can use the getISOWeekday()
function from date-fns to get the day of the week as an ISO day number (1-7, Monday is 1 and Sunday is 7) for a given date:
index.tsx107 chars4 lines
In this example, we're getting the ISO day number for June 22nd, 2021, which is a Tuesday, so the value of isoDay
will be 2
.
gistlibby LogSnag