var now = new Date(a);var nowTime = now.getTime() ;
var day = now.getDay();
var oneDayTime = 24*60*60*1000 ;
var MondayTime = nowTime - (day-1)*oneDayTime ;// Display Monday
var SundayTime = nowTime + (7-day)*oneDayTime ;// Display Sunday
console.log(new Date(MondayTime));
console.log(new Date(SundayTime))
Copy the code