From 6bfa11dd8dd3ac5448f65b5dcec9b480bfea0fa6 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Tue, 2 Jul 2024 08:08:18 +0200 Subject: [PATCH] fix: format clock as timer --- apps/client/src/features/viewers/common/viewUtils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/client/src/features/viewers/common/viewUtils.ts b/apps/client/src/features/viewers/common/viewUtils.ts index 391e7e93fe..44289a2540 100644 --- a/apps/client/src/features/viewers/common/viewUtils.ts +++ b/apps/client/src/features/viewers/common/viewUtils.ts @@ -3,6 +3,7 @@ import { MILLIS_PER_MINUTE, MILLIS_PER_SECOND, millisToString, removeLeadingZero import type { ViewExtendedTimer } from '../../../common/models/TimeManager.type'; import { timerPlaceholder, timerPlaceholderMin } from '../../../common/utils/styleUtils'; +import { formatTime } from '../../../common/utils/time'; type TimerTypeParams = Pick; @@ -68,11 +69,13 @@ export function getFormattedTimer( return options.removeSeconds ? timerPlaceholderMin : timerPlaceholder; } - let timeToParse = timer; + if (timerType === TimerType.Clock) { + return formatTime(timer); + } + let timeToParse = timer; if (options.removeSeconds) { - const timerIsTimeOfDay = timerType === TimerType.Clock; - const isNegative = timeToParse < -MILLIS_PER_SECOND && !timerIsTimeOfDay && timerType !== TimerType.CountUp; + const isNegative = timeToParse < -MILLIS_PER_SECOND && timerType !== TimerType.CountUp; if (isNegative) { // in negative numbers, we need to round down timeToParse -= MILLIS_PER_MINUTE;