mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 18:03:47 +00:00
c169c419c3
The first pass pinned the count-to-end end with `Math.max(expectedStart, plannedEnd)`, but those operands live in different coordinate spaces: `getExpectedStart` bakes in the day shift, the relative-start shift and the live runtime offset, while `plannedEnd` was raw time-of-day. The result was only correct in single-day Absolute mode and drifted in Relative mode and across day boundaries. A count-to-end event is anchored to its fixed wall-clock end, so its expected end is the scheduled end normalised for the day, with no runtime offset and no relative-start shift (matching getExpectedFinish, which returns the raw timeEnd). Compute it directly as `normalisedTimeStart + duration`. Add relative-mode and multi-day unit tests covering the cases the previous formula got wrong. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ACGuFWt5aN7Fv3AkYXgxLm