// 获取并格式化时间参数
getTimeParams(t) {
let endDate = new Date();
let startDate = new Date(endDate.getTime() - (t * 24 * 60 * 60 * 1000));
let startYear = startDate.getFullYear();
let endYear = endDate.getFullYear();
let startMonth = (startDate.getMonth() + 1) < 10 ? `0${
startDate.getMonth() + 1}` : (startDate.getMonth() + 1);
let endMonth = (endDate.getMonth() + 1) < 10 ? `0${
endDate.getMonth() + 1}` : (endDate.getMonth() + 1);
let startDay = startDate.getDate() < 10 ? `0${
startDate.getDate()}` : startDate.getDate();
let endDay = endDate.getDate() < 10 ? `0${
endDate.getDate()}` : endDate.getDate();
this.timeQuery.beginTime = `${
startYear}-${
startMonth}-${
startDay}T00:00:00+08:00`;
this.timeQuery.endTime = `${
endYear}-${
endMonth}-${
endDay}T23:59:59+08:00`;
},
最近7天,最近10天,最近90天时间处理逻辑
猜你喜欢
转载自blog.csdn.net/weixin_43131046/article/details/125206412
今日推荐
周排行