how to use getisoday from date-fns in javascript

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.tsx
const { getISOWeekday } = require('date-fns');

const isoDay = getISOWeekday(new Date('2021-06-22')); // 2
107 chars
4 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