Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-79198

Passing UTC time with DateTime/QVariant(with currentDateTimeUtc) to QML does not convert time correctly.

    XMLWordPrintable

Details

    Description

      User found out that QDateTime and QVariant that get values using 

      QDateTime::currentDateTimeUtc() get converted to non-UTC time when values are passed to QML with engine.rootContext()->setContextProperty().

      Tested in support and could get the following results:
      (C++) DateTime QDateTime(2019-10-14 10:01:24.693 UTC Qt::UTC)
      (C++) DateTimeInVariant QVariant(QDateTime, QDateTime(2019-10-14 10:01:24.693 UTC Qt::UTC))
      qml: (QML) DateTime Mon Oct 14 13:01:24 2019 GMT+0300
      qml: (QML) DateTimeInVariant Mon Oct 14 13:01:24 2019 GMT+0300
      

      Example code is attached.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tero.pelkonen Tero Pelkonen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes