From e395faaf3db958bcab87d91936a5585ad9a572c3 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Fri, 10 Dec 2021 15:09:31 +0800 Subject: - 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) --- utils/numberUtils.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'utils') 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 -- cgit