Answers for "how to find out previous sunday and monday in javascript"

2

javascript get date of last monday

let prevMonday = new Date();
prevMonday = new Date(prevMonday.setDate(prevMonday.getDate() - (prevMonday.getDay() + 6) % 7));
// sets the date object to last Monday, if the current day is Monday,
// set it to the current date

prevMonday = new Date(prevMonday.setHours(0,0,0)); // sets hours, mins, secs to 0
Posted by: Guest on March-08-2021
0

get previous week date in javascript

function nextweek(){
    var today = new Date();
    var nextweek = new Date(today.getFullYear(), today.getMonth(), today.getDate()+7);
    return nextweek;
}
Posted by: Guest on March-08-2020

Code answers related to "how to find out previous sunday and monday in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language