aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/numberUtils.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/numberUtils.js b/utils/numberUtils.js
index 7889d74..97693e1 100644
--- a/utils/numberUtils.js
+++ b/utils/numberUtils.js
@@ -5,7 +5,7 @@ let utils = {
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
},
- addNotation: function (type, value, joiner="") {
+ addNotation: function (type, value, joiner = "") {
let returnVal = value;
let notList = [];
if (type === "shortScale") {
@@ -91,6 +91,14 @@ let utils = {
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`
+ },
timeNumber2: (time) => {
let hours = Math.floor(time / 1000 / 60 / 60)
let mins = Math.floor(time / 1000 / 60) % 60
@@ -99,4 +107,4 @@ let utils = {
return `${hours}h ${mins}m`
}
}
-module.exports = utils \ No newline at end of file
+module.exports = utils