From 0d9892645caa601d87b8c8c4578ad7740d593701 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 10 Jan 2016 22:07:58 -0800 Subject: 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 --- qt-mobile/qmlmanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-70-g09d2