赞
踩
getSelectWeek() {//当前日期的前7天日期,当天也算一天 let data = new Date(); console.log(this.returnday(data, 6)) }, returnday(date, i) { //data是日期,i是往前推多少天 let newDate = new Date(date.getTime() - i * 1000 * 60 * 60 * 24); let year = newDate.getFullYear(); let month = parseInt(newDate.getMonth()) + 1 > 9 ? parseInt(newDate.getMonth()) + 1 : "0" + (parseInt(newDate.getMonth()) + 1); let day = newDate.getDate() > 9 ? newDate.getDate() : "0" + newDate.getDate(); let fullDate = `${year}-${month}-${day}`; // console.log(fullDate); return fullDate; },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。