From f8f0eff273ba832f8b8ae8b27d4d3cf7a2d2efb7 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 11 Nov 2020 14:27:10 +0100 Subject: Use QDate::startOfDay() rather than QDateTime(,QTime(0, 0),) Makes no difference in this case, as it's UTC, but is terser and perhaps slightly clearer. Change-Id: I7de315def2f45ec4a12d2a682e5d1d7a4d0a3e6d Reviewed-by: Fabian Kosmale --- src/qml/jsruntime/qv4dateobject.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/qml/jsruntime/qv4dateobject.cpp') diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 19ae62f054..a4d3c8ca30 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -637,9 +637,8 @@ static inline double ParseString(const QString &s, double localTZA) for (const QString &format : formats) { dt = format.indexOf(QLatin1String("hh:mm")) < 0 - ? QDateTime(QDate::fromString(s, format), - QTime(0, 0, 0), Qt::UTC) - : QDateTime::fromString(s, format); // as local time + ? QDate::fromString(s, format).startOfDay(Qt::UTC) + : QDateTime::fromString(s, format); // as local time if (dt.isValid()) break; } -- cgit v1.2.3