|
|
@ -20,12 +20,13 @@ function formatTime(timeStr) { |
|
|
const diffHours = Math.floor(diffMins / 60); |
|
|
const diffHours = Math.floor(diffMins / 60); |
|
|
const diffDays = Math.floor(diffHours / 24); |
|
|
const diffDays = Math.floor(diffHours / 24); |
|
|
|
|
|
|
|
|
|
|
|
const t = i18n.global.t |
|
|
if (diffHours < 1) { |
|
|
if (diffHours < 1) { |
|
|
return `${diffMins}分钟前` |
|
|
|
|
|
|
|
|
return `${diffMins}${t('home.difftime.minuteAgo')}` |
|
|
} else if (diffDays < 1) { |
|
|
} else if (diffDays < 1) { |
|
|
return `${diffHours}小时前` |
|
|
|
|
|
|
|
|
return `${diffHours}${t('home.difftime.hourAgo')}` |
|
|
} else if (diffDays === 1) { |
|
|
} else if (diffDays === 1) { |
|
|
return '昨天' |
|
|
|
|
|
|
|
|
return t('home.difftime.yesterday') |
|
|
} else { |
|
|
} else { |
|
|
return `${msgTime.getFullYear()}-${String(msgTime.getMonth() + 1).padStart(2, '0')}-${String(msgTime.getDate()).padStart(2, '0')}` |
|
|
return `${msgTime.getFullYear()}-${String(msgTime.getMonth() + 1).padStart(2, '0')}-${String(msgTime.getDate()).padStart(2, '0')}` |
|
|
} |
|
|
} |
|
|
|