diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-06 21:12:41 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-06 21:12:41 +0800 |
commit | 994b25cf01b1cd5fba879908cb8a524add6c2c24 (patch) | |
tree | 3a69f74c01ee0766c92e574fe3d3a079af1c227b /utils | |
parent | 735d50d9a298a6da66974eeec5efa4fcbb95a733 (diff) | |
parent | 38a8311c803763120571ca33ac4d8c31b5e6af68 (diff) | |
download | SoopyV2-994b25cf01b1cd5fba879908cb8a524add6c2c24.tar.gz SoopyV2-994b25cf01b1cd5fba879908cb8a524add6c2c24.tar.bz2 SoopyV2-994b25cf01b1cd5fba879908cb8a524add6c2c24.zip |
Merge branch 'master' of https://github.com/Soopyboo32/SoopyV2
Diffstat (limited to 'utils')
-rw-r--r-- | utils/numberUtils.js | 12 |
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 |