This commit is contained in:
bb_pan 2025-03-31 09:53:28 +08:00
parent 982fb201ea
commit 5ffd0000cb
2 changed files with 10 additions and 14 deletions

View File

@ -431,15 +431,14 @@ export default {
//
getDefaultDateRange() {
const today = new Date()
const lastMonth = new Date()
//
//
const lastMonth = new Date(today)
lastMonth.setMonth(today.getMonth() - 1)
//
if (today.getMonth() === 0) {
lastMonth.setFullYear(today.getFullYear() - 1)
lastMonth.setMonth(11)
//
if (lastMonth.getDate() !== today.getDate()) {
lastMonth.setDate(0) //
}
const formatDate = date => {
@ -449,7 +448,6 @@ export default {
return `${y}-${m}-${d}`
}
//
return [formatDate(lastMonth), formatDate(today)]
}
},

View File

@ -224,15 +224,14 @@ export default {
//
getDefaultDateRange() {
const today = new Date()
const lastMonth = new Date()
//
//
const lastMonth = new Date(today)
lastMonth.setMonth(today.getMonth() - 1)
//
if (today.getMonth() === 0) {
lastMonth.setFullYear(today.getFullYear() - 1)
lastMonth.setMonth(11)
//
if (lastMonth.getDate() !== today.getDate()) {
lastMonth.setDate(0) //
}
const formatDate = date => {
@ -242,7 +241,6 @@ export default {
return `${y}-${m}-${d}`
}
//
return [formatDate(lastMonth), formatDate(today)]
},
//