|
|
|
@@ -29,22 +29,30 @@ export const elapsedTime = (begin?: string | null, end?: string | null): string |
|
|
|
const hours = duration.hours(); |
|
|
|
const minutes = duration.minutes(); |
|
|
|
const seconds = duration.seconds(); |
|
|
|
const elspsedArray = []; |
|
|
|
if (years !== 0) { |
|
|
|
return `${years}年${months}个月`; |
|
|
|
elspsedArray.push(`${years}年`); |
|
|
|
} |
|
|
|
if (months !== 0) { |
|
|
|
return `${months}个月${days}天`; |
|
|
|
elspsedArray.push(`${months}个月`); |
|
|
|
} |
|
|
|
if (days !== 0) { |
|
|
|
return `${days}天${hours}小时`; |
|
|
|
elspsedArray.push(`${days}天`); |
|
|
|
} |
|
|
|
if (hours !== 0) { |
|
|
|
return `${hours}小时${minutes}分`; |
|
|
|
elspsedArray.push(`${hours}小时`); |
|
|
|
} |
|
|
|
if (minutes !== 0) { |
|
|
|
return `${minutes}分${seconds}秒`; |
|
|
|
elspsedArray.push(`${minutes}分`); |
|
|
|
} |
|
|
|
return `${seconds}秒`; |
|
|
|
if (seconds !== 0) { |
|
|
|
elspsedArray.push(`${seconds}秒`); |
|
|
|
} |
|
|
|
|
|
|
|
if (elspsedArray.length === 0) { |
|
|
|
return '0秒'; |
|
|
|
} |
|
|
|
return elspsedArray.slice(0, 2).join(''); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
|