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

QDateTime::addDays loses the UTC offset

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.8.0
    • Core: Date/Time
    • None

    Description

      The current code of QDateTime::addDays loses the UTC offset of a QDateTime, this can be easily checked by doing (in a non UTC timezone):

      const QDateTime original = QDateTime::currentDateTime();
      const QDateTime other = original.addDays(0);
      qDebug() << original.toString(Qt::ISODate) << other.toString(Qt::ISODate);
      

      This is probably because the current code for addDays is

      return QDateTime(d->date.addDays(ndays), d->time, timeSpec()); // Where did d->utcOffset go??
      

      Attachments

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

        Activity

          People

            earthdomain Earth Domain (Inactive)
            abustany Adrien Bustany
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes