mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 11:23:50 +00:00
23 lines
782 B
TypeScript
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),
|
|
};
|
|
}
|