showing results for - "javascript get date of last monday"
Ariadna
18 May 2019
1let prevMonday = new Date();
2prevMonday = new Date(prevMonday.setDate(prevMonday.getDate() - (prevMonday.getDay() + 6) % 7));
3// sets the date object to last Monday, if the current day is Monday,
4// set it to the current date
5
6prevMonday = new Date(prevMonday.setHours(0,0,0)); // sets hours, mins, secs to 0