diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-10 15:09:31 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-12-10 15:09:31 +0800 |
commit | e395faaf3db958bcab87d91936a5585ad9a572c3 (patch) | |
tree | 0dcca32ca46f98ca4e116d2320e26de98e49f64e /utils/numberUtils.js | |
parent | db4d8928b7b6d09bc599d35294f9622371f6f9ea (diff) | |
download | SoopyV2-e395faaf3db958bcab87d91936a5585ad9a572c3.tar.gz SoopyV2-e395faaf3db958bcab87d91936a5585ad9a572c3.tar.bz2 SoopyV2-e395faaf3db958bcab87d91936a5585ad9a572c3.zip |
- Add back /dung and /warp dung commands
- Make current pet and soulflow overlay use a default text when editing location to avoid it dissapearing
- Fixed sometimes pages in /soopyv2 sometimes not appearing
- Added /soopy (as alias for /soopyv2)
Diffstat (limited to 'utils/numberUtils.js')
-rw-r--r-- | utils/numberUtils.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/utils/numberUtils.js b/utils/numberUtils.js index ccc270e..63240de 100644 --- a/utils/numberUtils.js +++ b/utils/numberUtils.js @@ -46,5 +46,34 @@ module.exports = { } return returnVal; + }, + timeSince:function (date) { + if (typeof date !== 'object') { + date = new Date(date); + } + + var seconds = Math.floor((new Date()-date) / 1000); + var intervalType; + + var interval = Math.floor(seconds / 31536000); + interval = Math.floor(seconds / 86400); + if (interval >= 1) { + intervalType = 'd'; + } else { + interval = Math.floor(seconds / 3600); + if (interval >= 1) { + intervalType = "h"; + } else { + interval = Math.floor(seconds / 60); + if (interval >= 1) { + intervalType = "m"; + } else { + interval = seconds; + intervalType = "s"; + } + } + } + + return interval + '' + intervalType; } }
\ No newline at end of file |