Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.12.2
-
None
-
-
60deb69034e3d3ac36213ad8c36042ad57c495f7
Description
The QDateTime for midnight Jan 1 1970, and that datetime to the second alone, compares equal to the invalid datetime produced by QDateTime().
QDateTime::fromString("01/01/1970 00:00:00", "dd/MM/yyyy hh:mm:ss").isValid() => true
QDateTime::fromString("01/01/1970 00:00:00", "dd/MM/yyyy hh:mm:ss") == QDateTime() => true
See https://forum.qt.io/topic/112474/dealing-with-qdatetime-and-january-1-1970-at-00-00-00 for discussion.
This is in contravention to docs
https://doc.qt.io/qt-5/qdatetime.html#operator-eq-eq
bool QDateTime::operator==(const QDateTime &other) const
Returns true if this datetime is equal to the other datetime; otherwise returns false.
Since 5.14, all invalid datetimes are equal to one another and differ from all other datetimes.
since a valid datetime is comparing equal to an invalid one.
We realise this will be connected to the fact that the seconds elapsed since 1970 comes out at zero, but it is nasty behaviour
Attachments
Issue Links
- duplicates
-
QTBUG-79006 qml date property onValueChanged signal not called when first set to 1/1/1970
- Closed