From e90965a212330e7eadcd60706701dc42287f9040 Mon Sep 17 00:00:00 2001 From: mohit-nagaraj Date: Sat, 12 Oct 2024 01:08:36 +0530 Subject: [PATCH] better formatting --- src/pages/Details.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/pages/Details.vue b/src/pages/Details.vue index 50f4ec0dd..eb5b3d306 100644 --- a/src/pages/Details.vue +++ b/src/pages/Details.vue @@ -406,9 +406,24 @@ export default { }, formattedTime() { - const minutes = Math.floor(this.timeRemaining / 60); + const days = Math.floor(this.timeRemaining / 86400); + const hours = Math.floor((this.timeRemaining % 86400) / 3600); + const minutes = Math.floor((this.timeRemaining % 3600) / 60); const seconds = this.timeRemaining % 60; - return `${minutes}:${seconds.toString().padStart(2, '0')}`; + + let formattedTime = ''; + if (days > 0) { + formattedTime += `${days}:`; + } + if (hours > 0 || days > 0) { + formattedTime += `${hours}:`; + } + if (minutes > 0 || hours > 0 || days > 0) { + formattedTime += `${minutes}:`; + } + formattedTime += `${seconds}`; + + return formattedTime.trim(); }, },