JS 根据今天的日期获取本周星期一与星期天的日期

var now = new Date();
var nowTime = now.getTime();
var day = now.getDay();
var oneDayLong = 24 * 60 * 60 * 1000;

var MondayTime = nowTime - (day - 1) * oneDayLong;
var SundayTime = nowTime + (7 - day) * oneDayLong;

var monday = new Date(MondayTime);
var sunday = new Date(SundayTime);
console.log(monday);
console.log(sunday);

相关阅读

吐槽几句

  "(必填)"

  "(选填)"

  "(必填,不公开)"

(必填,最多100个字符。)(大家的评论

先说这么多吧