mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 06:29:07 +00:00
refactor: review studio design
This commit is contained in:
committed by
Carlos Valente
parent
3cd6cd2f55
commit
e0f2830072
@@ -0,0 +1,22 @@
|
||||
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),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user