fix: delays account for midnight

This commit is contained in:
Carlos Valente
2026-07-14 13:06:35 +02:00
committed by Carlos Valente
parent c8760b5e9c
commit 0c84a3ff9e
4 changed files with 38 additions and 6 deletions
+6
View File
@@ -3,6 +3,7 @@ import {
MILLIS_PER_HOUR,
MILLIS_PER_MINUTE,
MILLIS_PER_SECOND,
dayInMs,
formatFromMillis,
getExpectedStart,
} from 'ontime-utils';
@@ -29,6 +30,11 @@ export function nowInMillis(): number {
return elapsed;
}
export function normaliseWallClock(time: number): number {
const timeOfDay = time % dayInMs;
return timeOfDay < 0 ? timeOfDay + dayInMs : timeOfDay;
}
/**
* @description Resolves format from url and store
* @return {string|null} A format string like "hh:mm:ss a" or null