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

QDateTime in utc converted to string from QVariant are not restored correctly

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Fix Version/s: 5.2.0
    • Component/s: Core: Date/Time
    • Labels:
      None
    • Environment:

      Kubuntu quantal 64bits up to date

    • Commits:
      15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c

      Description

      QDateTime in utc converted to string within QVariant, then converted from QVariant string to datetime loose utc.

      #include <QtCore>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          const QDateTime dt1 = QDateTime::currentDateTimeUtc();
          const QDateTime dt2 = QVariant( dt1.toUTC() ).toDateTime();
          const QString dts = QVariant( dt1 ).toString();
          const QDateTime dt3 = QVariant( dts ).toDateTime();
      
          qWarning()
              << ( dt1 == dt2 ) // true
              << ( dt1 == dt2 ) // true
              << ( dt1 == dt3 ) // false
              << dts
          ;
      
          //return a.exec();
          return 0;
      }
      

        Attachments

        For Gerrit Dashboard: QTBUG-30250
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            mitch_curtis Mitch Curtis
            Reporter:
            pasnox Filipe Azevedo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes