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 <thiago.macieira@intel.com>
bb10
Edward Welbourne 2022-05-05 13:25:36 +02:00
parent 0757c74b48
commit fc1a844111
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}
/*!