From f5304668b94d5a401f0f10ec7cfbd1bb6b954105 Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Fri, 1 Sep 2023 22:13:04 +0200 Subject: [PATCH] refactor: allow 12hour format with seconds --- apps/client/src/common/utils/time.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/client/src/common/utils/time.ts b/apps/client/src/common/utils/time.ts index 269c07a12..dc0945f7b 100644 --- a/apps/client/src/common/utils/time.ts +++ b/apps/client/src/common/utils/time.ts @@ -51,6 +51,7 @@ export const formatTime = (milliseconds: number | null, options?: FormatOptions, return '...'; } const timeFormat = resolver(); - const { showSeconds = false, format: formatString = 'hh:mm a' } = options || {}; + const fallback = options?.showSeconds ? 'hh:mm:ss a' : 'hh:mm a'; + const { showSeconds = false, format: formatString = fallback } = options || {}; return timeFormat === '12' ? formatFromMillis(milliseconds, formatString) : millisToString(milliseconds, showSeconds); };