getNewDay(dateTemp, days) {
dateTemp = dateTemp.split("-");
//转换为MM-DD-YYYY格式
var nDate = new Date(dateTemp[1] + "-" + dateTemp[2] + "-" + dateTemp[0]);
var millSeconds = Math.abs(nDate) + days * 24 * 60 * 60 * 1000;
var rDate = new Date(millSeconds);
var year = rDate.getFullYear();
var month = rDate.getMonth() + 1;
if (month < 10) month = "0" + month;
var date = rDate.getDate();
if (date < 10) date = "0" + date;
return year + "-" + month + "-" + date;
},
使用
const end_time = this.getNewDay(options.time, options.day)
// options.time 起始日期
// options.day 间隔天数