This commit is contained in:
ds 2024-11-09 16:50:41 +08:00
parent f814c0fa37
commit c93515f1f2

View File

@ -229,12 +229,23 @@ export default {
this.timeIndex = index
this.disabled = true
if (this.timeList[index] == '今日') {
let start = new Date()
start.setHours(0)
start.setMinutes(0)
start.setSeconds(0)
start.setMilliseconds(0)
this.value2 = [start, new Date()]
let start = new Date();
start.setHours(0);
start.setMinutes(0);
start.setSeconds(0);
start.setMilliseconds(0);
let end = new Date();
function formatDate(date) {
let year = date.getFullYear();
let month = String(date.getMonth() + 1).padStart(2, '0');
let day = String(date.getDate()).padStart(2, '0');
let hours = String(date.getHours()).padStart(2, '0');
let minutes = String(date.getMinutes()).padStart(2, '0');
let seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
this.value2 = [formatDate(start), formatDate(end)];
console.log(this.value2);
} else if (this.timeList[index] == '近一周') {
let nowDate = new Date()
let oneWeekAgo = new Date(nowDate.getTime() - 6 * 24 * 60 * 60 * 1000)