mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 10:53:51 +00:00
fix: backdate rundown start when rolling
This commit is contained in:
committed by
Carlos Valente
parent
5ff7861968
commit
6f1f10ccff
@@ -1,4 +1,4 @@
|
||||
import { MaybeNumber, TimerPhase } from 'ontime-types';
|
||||
import { Day, MaybeNumber, TimerPhase } from 'ontime-types';
|
||||
import { checkIsNow, dayInMs, isPlaybackActive, MILLIS_PER_HOUR } from 'ontime-utils';
|
||||
|
||||
import type { RuntimeState } from '../stores/runtimeState.js';
|
||||
@@ -188,9 +188,9 @@ export function getTimerPhase(state: RuntimeState): TimerPhase {
|
||||
* Finds the day offset relative to an event start
|
||||
* used byt the runtimeState on first start to get correct offsets
|
||||
*/
|
||||
export function findDayOffset(plannedStart: number, clock: number): number {
|
||||
export function findDayOffset(plannedStart: number, clock: number): Day {
|
||||
const distance = clock - plannedStart;
|
||||
if (distance >= 12 * MILLIS_PER_HOUR) return -1;
|
||||
if (distance < -12 * MILLIS_PER_HOUR) return 1;
|
||||
return 0;
|
||||
if (distance >= 12 * MILLIS_PER_HOUR) return -1 as Day;
|
||||
if (distance < -12 * MILLIS_PER_HOUR) return 1 as Day;
|
||||
return 0 as Day;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user