js 获得每周周日到周一日期

//得到每周的第一天(周日)
function getFirstDateOfWeek(theDate){
 var firstDateOfWeek;
 theDate.setDate(theDate.getDate() - theDate.getDay()); // 
 firstDateOfWeek = theDate;
 return firstDateOfWeek; 
}
//得到每周的最后一天(周六)
function getLastDateOfWeek(theDate){
 var lastDateOfWeek;
 theDate.setDate(theDate.getDate() + 6 - theDate.getDay()); // 
 lastDateOfWeek = theDate;
 return lastDateOfWeek; 
}

原文地址:https://www.cnblogs.com/dancser/p/3264784.html