From 6a5272da7a0a645561383b73604500ff799488dd Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 7 May 2024 15:01:16 +0200 Subject: [PATCH] Fix: Check if endTime is still on the same day. --- library/src/calculator_functions.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index bbdf267..7ed840f 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -649,8 +649,10 @@ CalcState Calculator::isParkingAllowedForWeekDay(Configuration const *cfg, QTime const &startTime = start.time(); if (startTime >= from && startTime <= until) { - QTime const endTime = start.addSecs(netto_parking_time*60).time(); - if (endTime <= until) { + QDateTime const end = start.addSecs(netto_parking_time*60); + QTime const endTime = end.time(); + if (endTime <= until && start.date().dayOfWeek() == end.date().dayOfWeek()) { + qCritical() << DBG_HEADER; return CalcState(CalcState::State::SUCCESS, "PARKING_ALLOWED", from, until); } else { errorStr = QString("%1 startTime not in range (%2 not in [%3, %4))")