From d8e457323c2d2ef72ab81838ba82300672e4e26e Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 4 Jun 2012 16:59:46 +0200 Subject: Allow 24:00:00 for ISO dates in QDateTime::fromString(). ISO 8601 section 4.2.3 states that "The end of one calendar day [24:00] coincides with [00:00] at the start of the next calendar day", so fromString() was updated to account for this. Task-number: QTBUG-25387 Change-Id: I391db0da755dbc822ba0820c302a2c10391e1f3b Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index eb6af23ba5..e4cdb1a5c8 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -1268,6 +1268,22 @@ void tst_QDateTime::fromStringTextDate_data() << 28 << 6 << 2005 << 7 << 57 << 30 << 110 << int(Qt::LocalTime); + // Should be next day according to ISO 8601 section 4.2.3. + QTest::newRow("ISO date 24:00") << QString("2012-06-04T24:00:00") + << int(Qt::ISODate) + << 5 << 6 << 2012 << 0 << 0 << 0 << 0 + << int(Qt::LocalTime); + + QTest::newRow("ISO date 24:00 end of month") << QString("2012-06-30T24:00:00") + << int(Qt::ISODate) + << 1 << 7 << 2012 << 0 << 0 << 0 << 0 + << int(Qt::LocalTime); + + QTest::newRow("ISO date 24:00 end of month and year") << QString("2012-12-31T24:00:00") + << int(Qt::ISODate) + << 1 << 1 << 2013 << 0 << 0 << 0 << 0 + << int(Qt::LocalTime); + QTest::newRow("Year 0999") << QString("Tue Jun 17 08:00:10 0999") << int(Qt::TextDate) << 17 << 6 << 999 << 8 << 0 << 10 << 0 -- cgit v1.2.3