Use correct date format

A very very trival fix, for a mysterious issue. When loading
GPS fix data from the server, the string date was parsed with
the format "yyy-M-d". And no, the "yyy" is no typo here, but
was the reason that data from the read from server got a
1/1/1970 data. And when a user decided to upload that data
to the server again, we ended up with 2 copies of the
GPS fix. One with correct data (as originally saved), and
one new with the bogus date.

In order to het rid of those weird 1/1/1970 GPS fixes, users
will have to remove them by hand.

Fixes: #567

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-12-25 18:53:43 +01:00
parent ca38644005
commit 37e98a8d89

View file

@ -601,7 +601,7 @@ void GpsLocation::downloadFromServer()
qDebug() << downloadedFixes.count() << "GPS fixes downloaded";
for (int i = 0; i < downloadedFixes.count(); i++) {
QJsonObject fix = downloadedFixes[i].toObject();
QDate date = QDate::fromString(fix.value("date").toString(), "yyy-M-d");
QDate date = QDate::fromString(fix.value("date").toString(), "yyyy-M-d");
QTime time = QTime::fromString(fix.value("time").toString(), "hh:m:s");
QString name = fix.value("name").toString();
QString latitude = fix.value("latitude").toString();