aboutsummaryrefslogtreecommitdiff
path: root/utils/numberUtils.js
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-14 08:30:43 +0800
committerGitHub <noreply@github.com>2022-09-14 08:30:43 +0800
commit7d94a3b18a6a5fa8cdd3e067a32b21f3f751aee8 (patch)
tree82daabee4afdad5d91399734d04be38cd88d4614 /utils/numberUtils.js
parent01d78947793e0ee6f0b0dcbd0af072a7c9be9232 (diff)
parent62a8f8d492f92ccb241abfb66406caeddd4efa54 (diff)
downloadSoopyV2-7d94a3b18a6a5fa8cdd3e067a32b21f3f751aee8.tar.gz
SoopyV2-7d94a3b18a6a5fa8cdd3e067a32b21f3f751aee8.tar.bz2
SoopyV2-7d94a3b18a6a5fa8cdd3e067a32b21f3f751aee8.zip
Merge pull request #64 from EmeraldMerchant/patch-59
fix rounding error
Diffstat (limited to 'utils/numberUtils.js')
-rw-r--r--utils/numberUtils.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/numberUtils.js b/utils/numberUtils.js
index 327f875..8d5e7c3 100644
--- a/utils/numberUtils.js
+++ b/utils/numberUtils.js
@@ -86,9 +86,9 @@ let utils = {
},
timeNumber: (time, secondDecimals = 0) => {
let mins = Math.floor(time / 1000 / 60)
- let secs = Math.floor(time / 1000) % 60
+ let secs = (time / 1000) % 60
- if (mins === 0) return secs + "s"
+ if (mins === 0) return `${secs.toFixed(secondDecimals)}s`
return `${mins}m ${secs.toFixed(secondDecimals)}s`
},
timeNumber2: (time) => {