Files
ontime/apps/client/src/views/studio/studioTimers.utils.ts
T
2025-06-22 11:20:53 +02:00

23 lines
782 B
TypeScript

import { OntimeEvent, Runtime, TimerState } from 'ontime-types';
import { millisToString } from 'ontime-utils';
import { formatTime } from '../../common/utils/time';
const timeFormat = { format12: 'h:mm a', format24: 'HH:mm' };
export function getFormattedScheduleTimes(runtime: Runtime) {
return {
actualStart: formatTime(runtime.actualStart, timeFormat),
expectedEnd: formatTime(runtime.expectedEnd, timeFormat),
offset: millisToString(runtime.offset),
};
}
export function getFormattedEventData(eventNow: OntimeEvent | null, timer: TimerState) {
return {
title: eventNow?.title || '-',
startedAt: formatTime(timer.startedAt, timeFormat),
expectedEnd: formatTime(timer.expectedFinish, timeFormat),
timer: millisToString(timer.current),
};
}