获取给定月份的最后一天
getLastDay (date){
//debugger
let now = new Date(date);
let year = now.getFullYear();
let month = now.getMonth() + 1;//月份需要+1
let day = now.getDate();
let last = new Date(year,month,0);
let lastYear = last.getFullYear();
let lastMonth = last.getMonth()+1;
let lastDay = last.getDate();
lastMonth = lastMonth < 10 ? "0"+lastMonth:lastMonth;
lastDay = lastDay < 10 ? "0"+lastDay:lastDay;
return lastYear+"-"+lastMonth+"-"+lastDay;
}
获取给定月份的第一天
getSelectPreMonth (date){
let now = new Date(date);
let year = now.getFullYear();
let month = now.getMonth() + 1;
let day = "01";
month = month < 10 ? "0"+month:month;
return year+"-"+month+"-"+day;
}