aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorEmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com>2022-09-14 08:11:25 +0800
committerGitHub <noreply@github.com>2022-09-14 08:11:25 +0800
commitbdb7e164fe3ad56f3f61b04befe999eb134456b9 (patch)
treeb5ecfb2ac3ac0c61ed10196a97e5cc259e086098 /utils
parent01d78947793e0ee6f0b0dcbd0af072a7c9be9232 (diff)
downloadSoopyV2-bdb7e164fe3ad56f3f61b04befe999eb134456b9.tar.gz
SoopyV2-bdb7e164fe3ad56f3f61b04befe999eb134456b9.tar.bz2
SoopyV2-bdb7e164fe3ad56f3f61b04befe999eb134456b9.zip
fix rounding error
Diffstat (limited to 'utils')
-rw-r--r--utils/numberUtils.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/numberUtils.js b/utils/numberUtils.js
index 327f875..442015d 100644
--- a/utils/numberUtils.js
+++ b/utils/numberUtils.js
@@ -86,10 +86,11 @@ let utils = {
},
timeNumber: (time, secondDecimals = 0) => {
let mins = Math.floor(time / 1000 / 60)
- let secs = Math.floor(time / 1000) % 60
-
- if (mins === 0) return secs + "s"
- return `${mins}m ${secs.toFixed(secondDecimals)}s`
+ let secs = (time / 1000) % 60
+ let text = ""
+ if (mins === 0) text = `${secs.toFixed(secondDecimals)}s`
+ else text = `${mins}m ${secs.toFixed(secondDecimals)}s`
+ return text
},
timeNumber2: (time) => {
let hours = Math.floor(time / 1000 / 60 / 60)