UI: DateUtil: Fix converting a date to date-time.

This commit is contained in:
Nodir Temirkhodjaev 2020-09-06 13:08:49 +03:00
parent 6e0b300b95
commit bfa9d41c01

View File

@ -29,7 +29,7 @@ qint32 DateUtil::getUnixHour(qint64 unixTime)
qint32 DateUtil::getUnixDay(qint64 unixTime)
{
const QDate date = QDateTime::fromSecsSinceEpoch(unixTime).date();
const QDateTime dateTime = QDateTime(date, QTime(0, 0), Qt::UTC);
const QDateTime dateTime = date.startOfDay(Qt::UTC);
return getUnixHour(dateTime.toSecsSinceEpoch());
}
@ -42,7 +42,7 @@ qint32 DateUtil::getUnixMonth(qint64 unixTime, int monthStart)
}
const QDate dateMonth = QDate(date.year(), date.month(), 1);
const QDateTime dateTime = QDateTime(dateMonth, QTime(0, 0), Qt::UTC);
const QDateTime dateTime = dateMonth.startOfDay(Qt::UTC);
return getUnixHour(dateTime.toSecsSinceEpoch());
}