diff --git a/apps/client/src/features/viewers/common/__tests__/viewerUtils.test.ts b/apps/client/src/features/viewers/common/__tests__/viewerUtils.test.ts index f8b692ca8..3bc08e277 100644 --- a/apps/client/src/features/viewers/common/__tests__/viewerUtils.test.ts +++ b/apps/client/src/features/viewers/common/__tests__/viewerUtils.test.ts @@ -1,21 +1,21 @@ -import { removePrefixZeroes } from '../viewerUtils.js'; +import { removePrependedZero } from '../viewerUtils.js'; describe('removePrependedZero', () => { it('should remove "00:" from the start of the string', () => { const timer = '00:10:10'; - const result = removePrefixZeroes(timer); + const result = removePrependedZero(timer); expect(result).toBe('10:10'); }); it('should remove "00:0:" from the start of the string', () => { const timer = '00:01:10'; - const result = removePrefixZeroes(timer); + const result = removePrependedZero(timer); expect(result).toBe('1:10'); }); it('should not modify the string if it does not start with "00:" or "00:0:"', () => { const timer = '10:10:10'; - const result = removePrefixZeroes(timer); + const result = removePrependedZero(timer); expect(result).toBe(timer); }); }); diff --git a/apps/client/src/features/viewers/common/viewerUtils.ts b/apps/client/src/features/viewers/common/viewerUtils.ts index 8a1b47f24..cc9b133fa 100644 --- a/apps/client/src/features/viewers/common/viewerUtils.ts +++ b/apps/client/src/features/viewers/common/viewerUtils.ts @@ -28,7 +28,7 @@ export function getTimerByType(timerObject?: TimerTypeParams): number | null { * Receives a string such as 00:10:10 and removes the hours field if it is 00 * @param timer */ -export const removePrefixZeroes = (timer: string): string => { +export const removePrependedZero = (timer: string): string => { if (timer.startsWith('00:0')) { return timer.slice(4); } @@ -37,15 +37,3 @@ export const removePrefixZeroes = (timer: string): string => { } return timer; }; - -/** - * Receives a string such as 00:10:00 and removes the seconds field if it is 00 - * @param timer - */ -export const removePostZeroes = (timer: string): string => { - if (timer.endsWith(':00')) { - return timer.slice(0, -3); - } - - return timer; -}; diff --git a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx index d12f75eb5..e4ebd924e 100644 --- a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx +++ b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx @@ -12,7 +12,7 @@ import { OverridableOptions } from '../../../common/models/View.types'; import { formatTime } from '../../../common/utils/time'; import { isStringBoolean } from '../../../common/utils/viewUtils'; import { useTranslation } from '../../../translation/TranslationProvider'; -import { getTimerByType, removePrefixZeroes } from '../common/viewerUtils'; +import { getTimerByType, removePrependedZero } from '../common/viewerUtils'; import './MinimalTimer.scss'; @@ -159,7 +159,7 @@ export default function MinimalTimer(props: MinimalTimerProps) { showSeconds: !userOptions.hideTimerSeconds, format: 'hh:mm:ss a', }); - display = removePrefixZeroes(display); + display = removePrependedZero(display); if (display.length < 3) { display = `${display} ${getLocalizedString('common.minutes')}`; } diff --git a/apps/client/src/features/viewers/timer/Timer.tsx b/apps/client/src/features/viewers/timer/Timer.tsx index bbe0693ef..15fa926c8 100644 --- a/apps/client/src/features/viewers/timer/Timer.tsx +++ b/apps/client/src/features/viewers/timer/Timer.tsx @@ -15,7 +15,7 @@ import { formatTime } from '../../../common/utils/time'; import { isStringBoolean } from '../../../common/utils/viewUtils'; import { useTranslation } from '../../../translation/TranslationProvider'; import SuperscriptTime from '../common/superscript-time/SuperscriptTime'; -import { getTimerByType, removePrefixZeroes } from '../common/viewerUtils'; +import { getTimerByType, removePrependedZero } from '../common/viewerUtils'; import './Timer.scss'; @@ -123,7 +123,7 @@ export default function Timer(props: TimerProps) { showSeconds: !userOptions.hideTimerSeconds, format: 'hh:mm:ss a', }); - display = removePrefixZeroes(display); + display = removePrependedZero(display); if (display.length < 3) { display = `${display} ${getLocalizedString('common.minutes')}`; }