diff --git a/static/js/pages/profile.js b/static/js/pages/profile.js index 78acca27..a65c2c18 100644 --- a/static/js/pages/profile.js +++ b/static/js/pages/profile.js @@ -190,10 +190,19 @@ new Vue({ }, secondsToDhm(seconds) { seconds = Number(seconds); - var dDisplay = `${Math.floor(seconds / (3600 * 24))}d `; - var hDisplay = `${Math.floor(seconds % (3600 * 24) / 3600)}h `; - var mDisplay = `${Math.floor(seconds % 3600 / 60)}m `; - return dDisplay + hDisplay + mDisplay; + let display = ""; + if (Math.floor(seconds / (3600 * 24)) > 0) { + display += `${Math.floor(seconds / (3600 * 24))} day${Math.floor(seconds / (3600 * 24)) > 1 ? "s" : ""}, `; + } + if (Math.floor(seconds % (3600 * 24) / 3600) > 0) { + display += `${Math.floor(seconds % (3600 * 24) / 3600)} hour${Math.floor(seconds % (3600 * 24) / 3600) > 1 ? "s" : ""}, `; + } + if (Math.floor(seconds % 3600 / 60) > 0) { + display += `${Math.floor(seconds % 3600 / 60)} minute${Math.floor(seconds % 3600 / 60) > 1 ? "s" : ""}`; + } else { + display = "less than a minute"; + } + return display; }, StrtoGulagInt() { switch (this.mode + "|" + this.mods) {