mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复最后运行时长多语言显示
This commit is contained in:
parent
25e8e8198d
commit
952ea2859e
|
@ -1,3 +1,5 @@
|
|||
import Intl from 'react-intl-universal';
|
||||
|
||||
export function diffTime(num: number) {
|
||||
const diff = num * 1000;
|
||||
|
||||
|
@ -12,15 +14,15 @@ export function diffTime(num: number) {
|
|||
const leave3 = leave2 % (60 * 1000);
|
||||
const seconds = Math.round(leave3 / 1000);
|
||||
|
||||
let returnStr = seconds + '秒';
|
||||
let returnStr = `${seconds} ${Intl.get('秒')}`;
|
||||
if (minutes > 0) {
|
||||
returnStr = minutes + '分' + returnStr;
|
||||
returnStr = `${minutes} ${Intl.get('分')} ` + returnStr;
|
||||
}
|
||||
if (hours > 0) {
|
||||
returnStr = hours + '小时' + returnStr;
|
||||
returnStr = `${hours} ${Intl.get('时')} ` + returnStr;
|
||||
}
|
||||
if (days > 0) {
|
||||
returnStr = days + '天' + returnStr;
|
||||
returnStr = `${days} ${Intl.get('天')} ` + returnStr;
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user