From fc1a84411130d183ae7be458f186659adf875d97 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 5 May 2022 13:25:36 +0200 Subject: [PATCH] Fix wrong QDateTime::isValid() to use the right QFlags method It's documented to return true "if both the date and the time are valid and they are valid in the current Qt::TimeSpec" but it was using testAnyFlag() so would have returned true if any one of the three conditions was met, rather than only if all three are met. Change-Id: I91746224009d820abaffb541d8f6d6b13142849b Reviewed-by: Thiago Macieira --- src/corelib/time/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 9b3a5a1a42..1588801e42 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -3775,7 +3775,7 @@ bool QDateTime::isNull() const bool QDateTime::isValid() const { auto status = getStatus(d); - return status.testAnyFlag(QDateTimePrivate::ValidDateTime); + return status.testFlag(QDateTimePrivate::ValidDateTime); } /*!