代码:
getLocalTime() {
var timeC = new Date().setMonth(new Date().getMonth() - 3);
var year = new Date(parseInt(timeC)).getFullYear()
var month = new Date(parseInt(timeC)).getMonth()+1;
var date = new Date(parseInt(timeC)).getDate();
if(month<10) {
month='0'+month
}
if(date<10) {
date= '0'+date
}
this.dateArr.push(year+'-'+month+'-'+date)
this.dateArr.push(new Date().getFullYear() + '-' + (new Date().getMonth()+1<10?'0'+(new Date().getMonth()+1):new Date().getMonth()+1<10)+'-'+(new Date().getDate()<10?'0'+(new Date().getDate()):new Date().getDate()))
console.log(this.dateArr)
},