Sometimes, we want to start the week on Monday with isoWeekday() with JavaScript.
In this article, we’ll look at how to start the week on Monday with isoWeekday() with JavaScript.
How to start the week on Monday with isoWeekday() with JavaScript?
To start the week on Monday with isoWeekday() with JavaScript, we call startOf with 'week' before calling isoWeekday.
For instance, w write
const begin = moment(date).startOf("week").isoWeekday(1);
to call startOf on the moment object to get the start of the week.
And then we call isoWeekday with 1 to set the start of the week to Monday.
Conclusion
To start the week on Monday with isoWeekday() with JavaScript, we call startOf with 'week' before calling isoWeekday.