docs(components): [date-picker] update calculation of shortcut key values (#16262)

* Update date-and-time-range.vue

Modified the calculation of the time control date range selection to a date function in JavaScript to correctly calculate the time span.

* Update docs/examples/datetime-picker/date-and-time-range.vue

---------

Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
yinyueyu 2024-03-28 17:27:46 +08:00 committed by GitHub
parent fa91eddb0d
commit 30b223bcde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,7 +37,7 @@ const shortcuts = [
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
start.setDate(start.getDate() - 7)
return [start, end]
},
},
@ -46,7 +46,7 @@ const shortcuts = [
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
start.setMonth(start.getMonth() - 1)
return [start, end]
},
},
@ -55,7 +55,7 @@ const shortcuts = [
value: () => {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
start.setMonth(start.getMonth() - 3)
return [start, end]
},
},