mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-25 08:59:13 +00:00
refactor: allow 12hour format with seconds
This commit is contained in:
@@ -51,6 +51,7 @@ export const formatTime = (milliseconds: number | null, options?: FormatOptions,
|
|||||||
return '...';
|
return '...';
|
||||||
}
|
}
|
||||||
const timeFormat = resolver();
|
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);
|
return timeFormat === '12' ? formatFromMillis(milliseconds, formatString) : millisToString(milliseconds, showSeconds);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user