|
@@ -183,7 +183,13 @@ const showCalendar = ref(false)
|
|
|
|
|
|
// 展示时间的格式
|
|
|
const onConfirm = (date) => {
|
|
|
- departureTime.value = date ? `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}` : ''
|
|
|
+ let year = date?.getFullYear()
|
|
|
+ let month = date?.getMonth() + 1 // getMonth() 返回的月份从 0 开始,所以需要加 1
|
|
|
+ let day = date?.getDate()
|
|
|
+ month = month < 10 ? '0' + month : month
|
|
|
+ day = day < 10 ? '0' + day : day
|
|
|
+
|
|
|
+ departureTime.value = date ? `${year}-${month}-${day}` : ''
|
|
|
showCalendar.value = false
|
|
|
}
|
|
|
|