getmonthDate() {
var monthDate = {};
var now = new Date(); //当前日期
var nowMonth = now.getMonth(); //当前月
var nowYear = now.getFullYear(); //当前年
//本月的开始时间
var monthStartDate = new Date(nowYear, nowMonth, 1);
var yy = monthStartDate.getFullYear() + "-";
var mm =
(monthStartDate.getMonth() + 1 < 10
? "0" + (monthStartDate.getMonth() + 1)
: monthStartDate.getMonth() + 1) + "-";
var dd =
monthStartDate.getDate() < 10
? "0" + monthStartDate.getDate()
: monthStartDate.getDate();
//本月的结束时间
var monthEndDate = new Date(nowYear, nowMonth + 1, 0);
var YY = monthEndDate.getFullYear() + "-";
var MM =
(monthEndDate.getMonth() + 1 < 10
? "0" + (monthEndDate.getMonth() + 1)
: monthEndDate.getMonth() + 1) + "-";
var DD =
monthEndDate.getDate() < 10
? "0" + monthEndDate.getDate()
: monthEndDate.getDate();
monthDate.start_day = yy + mm + dd;
monthDate.end_day = YY + MM + DD;
return monthDate
// this.params.start_day = yy + mm + dd; //本月的开始时间
// this.params.end_day = YY + MM + DD; //本月的结束时间
},
网友评论