mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
56b3ecb3f6
commit
0d9892645c
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue