From 34f8b95ec693fb2b7f08a25d0a6d98ab6a91cb2f Mon Sep 17 00:00:00 2001 From: Altonss <66519591+Altonss@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:22:51 +0100 Subject: [PATCH] Improve formatDuration (#713) * Update formatDuration.ts * fix formatting * fix formatting * Fix formatting --- ui/src/lib/formatDuration.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/lib/formatDuration.ts b/ui/src/lib/formatDuration.ts index 597103740..51a2c3b93 100644 --- a/ui/src/lib/formatDuration.ts +++ b/ui/src/lib/formatDuration.ts @@ -1,7 +1,10 @@ export const formatDurationSec = (t: number): string => { const hours = Math.floor(t / 3600); const minutes = Math.ceil((t - hours * 3600) / 60); - const str = [hours !== 0 ? hours + ' h' : '', minutes !== 0 ? minutes + ' min' : ''] + const str = [ + hours !== 0 ? hours + ' h' : '', + minutes !== 0 || hours === 0 ? minutes + ' min' : '' + ] .join(' ') .trim(); return str;