summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-01-04 16:31:31 -0200
committerMarc Mutz <marc.mutz@kdab.com>2016-01-09 09:13:44 +0000
commit49c743bdb972587e03944b68aa0290650163c5b1 (patch)
treea4dbbf3521a63ec557b68878a5af74042774a3cb /src/corelib/tools
parentc3d3604f4c7213d61e44ba0c310c270d08f881dd (diff)
QDate: fix calculation of the week number for the last days of 2020
Off-by-one error: we should have calculated whether the current year is leap, not the next year. This affected any 53-week leap years. Task-number: QTBUG-50273 Change-Id: I134ce5db2f82468585ffffff14264cb9f12998fd Reviewed-by: Martin Klapetek <mklapetek@kde.org> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qdatetime.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 9bbf5b8944..241b02df1b 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -583,7 +583,7 @@ int QDate::weekNumber(int *yearNumber) const
Q_ASSERT(week == 52 || week == 53);
} else if (week == 53) {
// maybe first week of next year
- int w = (yday - 365 - (QDate::isLeapYear(year + 1) ? 1 : 0) - wday + 10) / 7;
+ int w = (yday - 365 - (QDate::isLeapYear(year) ? 1 : 0) - wday + 10) / 7;
if (w > 0) {
++year;
week = w;