Fix: Check if endTime is still on the same day.

This commit is contained in:
Gerhard Hoffmann 2024-05-07 15:01:16 +02:00
parent 4d5583df2d
commit 6a5272da7a

View File

@ -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))")