// 获取最近30天
dateRange() {
const time1 = new Date().getTime();
const yesterday1 = new Date(time1);
const year1 = yesterday1.getFullYear();
const month1 = yesterday1.getMonth();
const day1 = yesterday1.getDate();
const time = time1 - 31 * 24 * 3600 * 1000;
const yesterday = new Date(time);
const year = yesterday.getFullYear();
const month = yesterday.getMonth();
const day = yesterday.getDate();
this.searchData.time = [
new Date(year, month, day),
new Date(year1, month1, day1),
];
},
// 获取当月到今天
getTime() {
const time1 = new Date().getTime();
const yesterday1 = new Date(time1);
const year1 = yesterday1.getFullYear();
const month1 = yesterday1.getMonth();
const day1 = yesterday1.getDate();
this.searchData.StartDate = new Date(year1, month1, 1);
this.searchData.EndDate = new Date(year1, month1, day1);
},
js获取最近30天 获取当月到当天
最新推荐文章于 2023-08-03 10:44:04 发布