fix: time language

This commit is contained in:
wangdan-fit2cloud 2025-01-23 16:38:20 +08:00
parent 663a6cad43
commit cabd6fb7f5
4 changed files with 23 additions and 5 deletions

View File

@ -17,5 +17,11 @@ export default {
remark: 'Remarks',
update: 'Update',
authorize: 'Authorized'
},
time: {
daysLater: 'days later',
hoursLater: 'hours later',
expired: 'expired',
expiringSoon: 'expiring soon'
}
}

View File

@ -16,5 +16,11 @@ export default {
remark: '备注',
update: '更新',
authorize: '授权给'
},
time: {
daysLater: '天后',
hoursLater: '小时后',
expired: '已过期',
expiringSoon: '即将到期'
}
}

View File

@ -17,5 +17,11 @@ export default {
remark: '備註',
update: '更新',
authorize: '授權給'
},
time: {
daysLater: '天後',
hoursLater: '小時後',
expired: '已過期',
expiringSoon: '即將到期'
}
}

View File

@ -1,7 +1,7 @@
import moment from 'moment'
import 'moment/dist/locale/zh-cn'
moment.locale('zh-cn')
import { t } from '@/locales'
// 当天日期 YYYY-MM-DD
export const nowDate = moment().format('YYYY-MM-DD')
@ -64,15 +64,15 @@ export function fromNowDate(time: any) {
return ''
} else {
if (exceedDay < 7 && exceedDay > 0) {
return exceedDay + '天后'
return exceedDay + t('layout.time.daysLater')
} else {
if (exceedHour < 24 && exceedHour > 0) {
return exceedHour + '小时后'
return exceedHour + t('layout.time.hoursLater')
} else {
if (exceedMin < 0) {
return '已过期'
return t('layout.time.expired')
} else {
return '即将到期'
return t('layout.time.expiringSoon')
}
}
}