diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-10 22:07:58 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-10 22:07:58 -0800 |
commit | 0d9892645caa601d87b8c8c4578ad7740d593701 (patch) | |
tree | 8a1a513079c4adfcaebf9fdbef0001b3727c80e6 | |
parent | 56b3ecb3f66a700d4b54269d7140d44a9cccd947 (diff) | |
download | subsurface-0d9892645caa601d87b8c8c4578ad7740d593701.tar.gz |
QML UI: only store the new date/time if they are valid
Otherwise we are overwriting valid data with midnight, Jan 1, 1970.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 79528cdff..02e451692 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -360,7 +360,8 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location date.replace(drop, ""); } newDate = QDateTime::fromString(date, format); - d->when = newDate.toMSecsSinceEpoch() / 1000 + gettimezoneoffset(newDate.toMSecsSinceEpoch() / 1000); + if (newDate.isValid()) + d->dc.when = d->when = newDate.toMSecsSinceEpoch() / 1000 + gettimezoneoffset(newDate.toMSecsSinceEpoch() / 1000); } struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid); char *locationtext = NULL; |