summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-12-03 11:40:59 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-12-09 19:47:55 +0100
commit8310981b806979642b025358055d394ee9045003 (patch)
tree30d0f2be3091a31700847a24665895c508da2144
parentc27123d7435e9451f3e44d9e823734e605279d0a (diff)
Prefer QDate::startOfDay() over QDateTime(const QDate &)
The latter can be invalid if midnight is skipped by a spring-forward. Change-Id: Ibf98d165557229f19622774ebf9a27bb0911c7a7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/time/qdatetime.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 4a1724bd39..ffb4892c99 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -5214,7 +5214,7 @@ QDateTime QDateTime::fromString(const QString &string, Qt::DateFormat format)
if (!date.isValid())
return QDateTime();
if (size == 10)
- return QDateTime(date);
+ return date.startOfDay();
Qt::TimeSpec spec = Qt::LocalTime;
QStringRef isoString(&string);