fix: 单位转换时间时ms固定为保留整数

This commit is contained in:
chenjinsong
2022-10-12 22:08:34 +08:00
parent 6391bfd98d
commit 5e10374398

View File

@@ -61,7 +61,7 @@ export function timeUnitFormatter (time, sourceUnit = 'ms', targetUnit, dot = 2)
multi = timeUnit[sourceIndex].step multi = timeUnit[sourceIndex].step
result /= multi result /= multi
} }
return [multi === 1 ? result : result.toFixed(dot), timeUnit[sourceIndex].unit] return [multi === 1 ? result.toFixed(0) : result.toFixed(dot), timeUnit[sourceIndex].unit]
} else { } else {
timeUnit.forEach((s, i) => { timeUnit.forEach((s, i) => {
if (i <= targetIndex) { if (i <= targetIndex) {