Replaced `PayByPhoneScript` with `GetLastDaysHistoryScript` in `main.cpp`. Introduced enhanced date/time utilities and improved database timestamp handling with `DateUtils`. Refactored `TransactionDAO` methods to separate parsing logic and added support for retrieving recent transactions within specified hours. Added the `GetLastDaysHistoryScript` class to parse and save recent transaction history.
26 lines
697 B
C++
26 lines
697 B
C++
#include "DateUtils.h"
|
|
|
|
DateUtils::DateUtils(QObject *parent) : QObject(parent) {
|
|
}
|
|
|
|
QDateTime DateUtils::getMoscowNow() {
|
|
const QTimeZone moscowTimeZone("Europe/Moscow");
|
|
return QDateTime::currentDateTime().toTimeZone(moscowTimeZone);
|
|
}
|
|
|
|
QDateTime DateUtils::getUtcNow() {
|
|
return QDateTime::currentDateTimeUtc();
|
|
}
|
|
|
|
QDateTime DateUtils::fromUtcString(const QString ×tamp) {
|
|
QDateTime dateTime = QDateTime::fromString(timestamp, "dd.MM.yyyy HH:mm:ss");
|
|
if (dateTime.isValid()) {
|
|
dateTime.setTimeZone(QTimeZone::utc());
|
|
}
|
|
return dateTime;
|
|
}
|
|
|
|
QString DateUtils::toUtcString(const QDateTime &dateTime) {
|
|
return dateTime.toString("dd.MM.yyyy HH:mm:ss");
|
|
}
|