Fix: for time change summer -> winter term. Compute minutes until midnight manually.
This commit is contained in:
		@@ -65,13 +65,22 @@ struct ATBTariffCarryOver {
 | 
			
		||||
        int minutes = 0;
 | 
			
		||||
        QString end = m_range.m_end.toString(Qt::ISODate);
 | 
			
		||||
        if (end == "24:00:00") {
 | 
			
		||||
            QDateTime t = dt.addDays(1);
 | 
			
		||||
            t.setTime(QTime(0,0,0));
 | 
			
		||||
            minutes = dt.secsTo(t) / 60;
 | 
			
		||||
            // note: this did not work
 | 
			
		||||
            // QDateTime t(dt.addDays(1));
 | 
			
		||||
            // t.setTime(QTime(0,0,0));
 | 
			
		||||
            // dt: 2024-10-27T00:00:00 EEST, but t: 2024-10-28T00:00:00 EET (!)
 | 
			
		||||
            // so the difference is 1500 instead of 1440
 | 
			
		||||
            // reason: change from summer to winter time
 | 
			
		||||
 | 
			
		||||
            // compute minutes directly
 | 
			
		||||
            if (dt.time().isValid()) {
 | 
			
		||||
                minutes = 1440 - (dt.time().hour() * 60 + dt.time().minute());
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            QDateTime t(dt);
 | 
			
		||||
            t.setTime(QTime::fromString(end, Qt::ISODate));
 | 
			
		||||
            minutes = dt.secsTo(t) / 60;
 | 
			
		||||
            QTime t(QTime::fromString(end, Qt::ISODate));
 | 
			
		||||
            if (t.isValid() && dt.time().isValid()) {
 | 
			
		||||
                minutes = (t.hour() * 60 + t.minute()) - (dt.time().hour() * 60 + dt.time().minute());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (minutes < 0 || minutes > m_range.m_duration) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user