aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/numberUtils.js12
1 files changed, 2 insertions, 10 deletions
diff --git a/utils/numberUtils.js b/utils/numberUtils.js
index 97693e1..327f875 100644
--- a/utils/numberUtils.js
+++ b/utils/numberUtils.js
@@ -84,20 +84,12 @@ let utils = {
}
return utils.timeNumber(time)
},
- timeNumber: (time) => {
+ 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}s`
- },
- timeNumberDetailed: (time, decimalPoint) => {
- let mins = Math.floor(time / 1000 / 60)
- let tenToDecimalPower = 10 ** decimalPoint
- let secs = Math.floor((time / 1000) * tenToDecimalPower)/tenToDecimalPower % 60
-
- if (mins === 0) return secs + "s"
- return `${mins}m ${secs}s`
+ return `${mins}m ${secs.toFixed(secondDecimals)}s`
},
timeNumber2: (time) => {
let hours = Math.floor(time / 1000 / 60 / 60)