//获取前一天的0点到 23点 const start = new Date(); const end = new Date(); start.setTime(new Date(new Date().toLocaleDateString()).getTime() - 3600 * 1000 * 24 * 1); end.setTime(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 -1 - 3600 * 1000 * 24 * 1) //获取当天的0点到 23点 start.setTime(new Date(new Date().toLocaleDateString()).getTime()); end.setTime(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 -1)
//数组化今天日期
const currentDateArray = new Date().toLocaleDateString().split('/').map(Number) //[2020, 7, 20]
//获取某年某月有多少天
let getMonthDays = (year,month) => {
let d = new Date(year, month, 0);
return d.getDate();
}
//计算某年某月一号是星期几
const computedFirstDay = (year, month) => {
return new Date(`${year}/${month}/1`).getDay()
}