Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-26038 Make Date/Time adhere to ISO 8601
  3. QTBUG-2813

Timestring without seconds not parsed correctly when using Qt::ISODate

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Done
    • P3: Somewhat important
    • 5.0.0 Beta 1
    • Core: Date/Time
    • None
    • I2578f290845e46a8f49be489f1d7427984ae7f08

    Description

      Running the code below produces:

      false
      true

      but both results should be true.

      Since the time is still valid according to ISO 8601 [1][2] section 4.2.2.3, it would be expected that QTime::fromString() returns a valid QTime instance representing 10:00.

      [1] http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetch&nodeid=4021199
      [2] http://dotat.at/tmp/ISO_8601-2004_E.pdf

      Code to reproduce:
      // -----------------------------------------
      #include <QtCore>

      int main( int argc, char * argv[] )
      {
      QCoreApplication app( argc, argv );

      QTime time = QTime::fromString( "10:00", Qt::ISODate );
      qDebug() << time.isValid();

      time = QTime::fromString( "10:00", "hh:mm" );
      qDebug() << time.isValid();

      return 0;
      }
      // -----------------------------------------

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mitch_curtis Mitch Curtis
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes