This commit is contained in:
2025-08-24 10:41:24 +08:00
parent d2e3c70616
commit 01b2c3385d
7 changed files with 24 additions and 34 deletions

View File

@@ -644,7 +644,7 @@ export default {
},
formatDate(dateString) {
return new Date(dateString).toLocaleString('zh-CN')
return this.$dayjs(dateString).format('YYYY-MM-DD HH:mm:ss')
},
/**
@@ -654,24 +654,17 @@ export default {
*/
formatDeadline(dateString) {
if (!dateString) return ''
const date = new Date(dateString)
const now = new Date()
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())
const targetDate = new Date(date.getFullYear(), date.getMonth(), date.getDate())
const date = this.$dayjs(dateString)
const now = this.$dayjs()
const timeStr = date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' })
const timeStr = date.format('HH:mm')
if (targetDate.getTime() === today.getTime()) {
if (date.isSame(now, 'day')) {
return `今天${timeStr}`
} else if (targetDate.getTime() === today.getTime() + 24 * 60 * 60 * 1000) {
} else if (date.isSame(now.add(1, 'day'), 'day')) {
return `明天${timeStr}`
} else {
return date.toLocaleString('zh-CN', {
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
})
return date.format('MM-DD HH:mm')
}
},