mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-07 07:19:16 +00:00
a5e733246d
* fix: format clock from preset * fix: add to all views * chore: format * refactor: return flat value from common.options.ts
22 lines
636 B
TypeScript
22 lines
636 B
TypeScript
import { secondsInMillis } from 'ontime-utils';
|
|
|
|
import { formatTime } from '../../common/utils/time';
|
|
|
|
/**
|
|
* Gathers display elements for the large studio clock
|
|
*/
|
|
export function getLargeClockData(clock: number, timeformat: string | null) {
|
|
const [display, meridian] = (() => {
|
|
const formatted = formatTime(clock, { override: timeformat });
|
|
if (formatted.endsWith('AM')) {
|
|
return [formatted.slice(0, -2), 'AM'];
|
|
}
|
|
if (formatted.endsWith('PM')) {
|
|
return [formatted.slice(0, -2), 'PM'];
|
|
}
|
|
return [formatted, undefined];
|
|
})();
|
|
|
|
return { seconds: secondsInMillis(clock), display, meridian };
|
|
}
|