Utilities::IsYearPeriodActive():

Fix: take into account if start-date <= end-date or not.
	     Otherwise check is wrong, and no valid year period is returned.
This commit is contained in:
Gerhard Hoffmann 2024-08-21 15:35:03 +02:00
parent 9b524d63e5
commit 80637260f3

View File

@ -207,7 +207,13 @@ bool Utilities::IsYearPeriodActive(Configuration const *cfg, QDateTime const &dt
dt.date().day()); dt.date().day());
QDate const s(2004, year.second.pye_start_month, year.second.pye_start_day); QDate const s(2004, year.second.pye_start_month, year.second.pye_start_day);
QDate const e(2004, year.second.pye_end_month, year.second.pye_end_day); QDate const e(2004, year.second.pye_end_month, year.second.pye_end_day);
return (d >= s && d <= e); //qCritical() << __func__ << __LINE__ << " d" << d.toString(Qt::ISODate);
//qCritical() << __func__ << __LINE__ << "start" << s.toString(Qt::ISODate);
//qCritical() << __func__ << __LINE__ << " end" << e.toString(Qt::ISODate);
if (s <= e) {
return (d >= s && d <= e);
}
return (d >= s || d <= e);
})) { })) {
qCritical() << "NO VALID YEAR PERIOD"; qCritical() << "NO VALID YEAR PERIOD";
return false; return false;