diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js index 5d75c69d..9f2a92eb 100644 --- a/data/interfaces/default/js/script.js +++ b/data/interfaces/default/js/script.js @@ -288,23 +288,10 @@ function isPrivateIP(ip_address) { } function humanTime(seconds) { - var d = Math.floor(moment.duration(seconds, 'seconds').asDays()); - var h = Math.floor(moment.duration((seconds % 86400), 'seconds').asHours()); - var m = Math.round(moment.duration(((seconds % 86400) % 3600), 'seconds').asMinutes()); - - var text = ''; - if (d > 0) { - text = '
day' + ((d > 1) ? 's' : '') + '
' - + 'hr' + ((h > 1) ? 's' : '') + '
' - + 'min' + ((m > 1) ? 's' : '') + '
'; - } else if (h > 0) { - text = 'hr' + ((h > 1) ? 's' : '') + '
' - + 'min' + ((m > 1) ? 's' : '') + '
'; - } else { - text = 'min' + ((m > 1) ? 's' : '') + '
'; + if (seconds > 0) { + return humanDuration(seconds * 1000).replaceAll(/(\d+) (\w+)/g, '$2
') } - - return text + return "mins
"; } String.prototype.toProperCase = function () {