mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-28 10:29:11 +00:00
fix: handle midnight
fixed issue where roll mode wouldnt recognise a end time lower than start time (go through midnight)
This commit is contained in:
@@ -973,7 +973,14 @@ export class EventTimer extends Timer {
|
|||||||
// loop through events, look for where we should be
|
// loop through events, look for where we should be
|
||||||
for (const [index, e] of this._eventlist.entries()) {
|
for (const [index, e] of this._eventlist.entries()) {
|
||||||
if (!foundNow) {
|
if (!foundNow) {
|
||||||
if (e.timeStart <= now && now < e.timeEnd) {
|
let normalEnd = e.timeEnd;
|
||||||
|
|
||||||
|
// handle midnight
|
||||||
|
if (normalEnd < e.timeStart) {
|
||||||
|
normalEnd += this.DAYMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.timeStart <= now && now < normalEnd) {
|
||||||
// set flag
|
// set flag
|
||||||
foundNow = true;
|
foundNow = true;
|
||||||
|
|
||||||
@@ -982,9 +989,9 @@ export class EventTimer extends Timer {
|
|||||||
this._secondaryTarget = null;
|
this._secondaryTarget = null;
|
||||||
|
|
||||||
this._startedAt = e.timeStart;
|
this._startedAt = e.timeStart;
|
||||||
this._finishAt = e.timeEnd;
|
this._finishAt = normalEnd;
|
||||||
this.duration = e.timeEnd - e.timeStart;
|
this.duration = normalEnd - e.timeStart;
|
||||||
this.current = e.timeEnd - now;
|
this.current = normalEnd - now;
|
||||||
|
|
||||||
// set selection
|
// set selection
|
||||||
this.selectedEventId = e.id;
|
this.selectedEventId = e.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user