Changeset 03b2b854 in subsurface


Ignore:
Timestamp:
Apr 16, 2017, 7:43:48 AM (5 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
20f525ce
Parents:
f2d8861
git-author:
Dirk Hohndel <dirk@…> (04/15/17 18:51:03)
git-committer:
Dirk Hohndel <dirk@…> (04/16/17 07:43:48)
Message:

QML UI: correctly parse manually edited date

We need to set the timeSpec after the QDateTime was parsed,
otherwise it gets converted to localtime again.

Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mobile-widgets/qmlmanager.cpp

    r6a50efd r03b2b854  
    590590        if (date != oldDate) {
    591591                QDateTime newDate;
    592                 newDate.setTimeSpec(Qt::UTC);
    593592                // what a pain - Qt will not parse dates if the day of the week is incorrect
    594593                // so if the user changed the date but didn't update the day of the week (most likely behavior, actually),
     
    604603                        date.replace(drop, "");
    605604                }
     605                // set date from string and make sure it's treated as UTC (like all our time stamps)
    606606                newDate = QDateTime::fromString(date, format);
     607                newDate.setTimeSpec(Qt::UTC);
    607608                if (!newDate.isValid()) {
    608609                        qDebug() << "unable to parse date" << date << "with the given format" << format;
Note: See TracChangeset for help on using the changeset viewer.