Commit 09849f97 authored by Stephane Mankowski's avatar Stephane Mankowski

Date 31/12 => 02/12

BUG:417163
parent 2754e913
skrooge (2.22.0)
*Correction bug 417163: Date 31/12 => 02/12
*Correction: Merge of number of operation
*Correction: Fix Get Hot New Stuff legacy Endpoints
*Correction: Files not able to be checked out on Windows
......
......@@ -518,8 +518,7 @@ QDate SKGServices::partialStringToDate(const QString& iDateString, bool iFixupBa
if (size == 1) {
int dayCount = items.at(0).toInt(&ok);
result = QDate::currentDate();
result = result.addDays(dayCount - result.day());
result = QDate(QDate::currentDate().year(), QDate::currentDate().month(), dayCount); ;
if (iFixupBackward) {
if (result > QDate::currentDate()) {
......@@ -534,9 +533,7 @@ QDate SKGServices::partialStringToDate(const QString& iDateString, bool iFixupBa
int dayCount = items.at(0).toInt(&ok);
int monthCount = items.at(1).toInt(&ok);
result = QDate::currentDate();
result = result.addDays(dayCount - result.day());
result = result.addMonths(monthCount - result.month());
result = QDate(QDate::currentDate().year(), monthCount, dayCount); ;
if (iFixupBackward) {
if (result > QDate::currentDate()) {
......@@ -553,9 +550,7 @@ QDate SKGServices::partialStringToDate(const QString& iDateString, bool iFixupBa
int yearCount = items.at(2).toInt(&ok);
int lengthYear = items.at(2).count();
result = QDate::currentDate();
result = result.addDays(dayCount - result.day());
result = result.addMonths(monthCount - result.month());
result = QDate(QDate::currentDate().year(), monthCount, dayCount); ;
if (lengthYear < 4) {
auto y = static_cast<int>(result.year() / qPow(10, lengthYear)) * qPow(10, lengthYear) + yearCount;
......
......@@ -80,8 +80,11 @@ void test_partialStringToDate(int& nberror, int& nbcheck, bool showonlyfailures)
QDate currentMonth10 = QDate::currentDate();
currentMonth10 = currentMonth10.addDays(10 - QDate::currentDate().day());
QDate current0102(QDate::currentDate().year(), 2, 1);
QDate current3112(QDate::currentDate().year(), 12, 31);
SKGTEST(QStringLiteral("CONV:partialStringToDate"), SKGServices::partialStringToDate(QStringLiteral("10"), true).toString(), (currentMonth10 <= QDate::currentDate() ? currentMonth10 : currentMonth10.addMonths(-1)).toString())
SKGTEST(QStringLiteral("CONV:partialStringToDate"), SKGServices::partialStringToDate(QStringLiteral("1/2"), true).toString(), (current0102 <= QDate::currentDate() ? current0102 : current0102.addYears(-1)).toString())
SKGTEST(QStringLiteral("CONV:partialStringToDate"), SKGServices::partialStringToDate(QStringLiteral("31/12"), true).toString(), (current3112 <= QDate::currentDate() ? current3112 : current3112.addYears(-1)).toString())
SKGTEST(QStringLiteral("CONV:partialStringToDate"), SKGServices::partialStringToDate(QStringLiteral("1/2/14"), true).toString(), QDate(2014, 2, 1).toString())
SKGTEST(QStringLiteral("CONV:partialStringToDate"), SKGServices::partialStringToDate(QStringLiteral("1/2/99"), true).toString(), QDate(1999, 2, 1).toString())
SKGTEST(QStringLiteral("CONV:partialStringToDate"), SKGServices::partialStringToDate(QStringLiteral("1/2/014"), true).toString(), QDate(2014, 2, 1).toString())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment