diff --git a/apps/client/src/common/components/view-params-editor/constants.ts b/apps/client/src/common/components/view-params-editor/constants.ts index 83bb6b80e..494d22858 100644 --- a/apps/client/src/common/components/view-params-editor/constants.ts +++ b/apps/client/src/common/components/view-params-editor/constants.ts @@ -30,6 +30,14 @@ const hideTimerSeconds: ParamField = { defaultValue: false, }; +const showLeadingZeros: ParamField = { + id: 'showLeadingZeros', + title: 'Show leading zeros in timer', + description: 'Whether to show leading zeros in the running timer', + type: 'boolean', + defaultValue: false, +}; + export const getClockOptions = (timeFormat: string): ParamField[] => [ getTimeOption(timeFormat), { @@ -107,6 +115,7 @@ export const getTimerOptions = (timeFormat: string, customFields: CustomFields): return [ getTimeOption(timeFormat), hideTimerSeconds, + showLeadingZeros, { id: 'hideClock', title: 'Hide Time Now', diff --git a/apps/client/src/features/viewers/common/viewUtils.ts b/apps/client/src/features/viewers/common/viewUtils.ts index 4b2159ac5..78a18bd33 100644 --- a/apps/client/src/features/viewers/common/viewUtils.ts +++ b/apps/client/src/features/viewers/common/viewUtils.ts @@ -84,7 +84,9 @@ export function getFormattedTimer( } let display = millisToString(timeToParse); - display = removeLeadingZero(display); + if (options.removeLeadingZero) { + display = removeLeadingZero(display); + } if (options.removeSeconds) { display = formatDisplayWithMinutes(display, localisedMinutes); diff --git a/apps/client/src/features/viewers/timer/Timer.tsx b/apps/client/src/features/viewers/timer/Timer.tsx index 66161e88c..ab66a1403 100644 --- a/apps/client/src/features/viewers/timer/Timer.tsx +++ b/apps/client/src/features/viewers/timer/Timer.tsx @@ -76,6 +76,7 @@ export default function Timer(props: TimerProps) { hideMessage: false, hideTimerSeconds: false, hideClockSeconds: false, + removeLeadingZeros: true, }; const hideClock = searchParams.get('hideClock'); @@ -97,6 +98,9 @@ export default function Timer(props: TimerProps) { const hideTimerSeconds = searchParams.get('hideTimerSeconds'); userOptions.hideTimerSeconds = isStringBoolean(hideTimerSeconds); + const showLeadingZeros = searchParams.get('showLeadingZeros'); + userOptions.removeLeadingZeros = !isStringBoolean(showLeadingZeros); + const secondarySource = searchParams.get('secondary-src'); const secondaryTextNow = getPropertyValue(eventNow, secondarySource); const secondaryTextNext = getPropertyValue(eventNext, secondarySource); @@ -126,7 +130,7 @@ export default function Timer(props: TimerProps) { const stageTimer = getTimerByType(viewSettings.freezeEnd, time); const display = getFormattedTimer(stageTimer, time.timerType, getLocalizedString('common.minutes'), { removeSeconds: userOptions.hideTimerSeconds, - removeLeadingZero: true, + removeLeadingZero: userOptions.removeLeadingZeros, }); const stageTimerCharacters = display.replace('/:/g', '').length;