Commit 81f5c1b7 authored by Volker Krause's avatar Volker Krause

Also update times with UTC offset to timezones, if the numbers match

parent 9afd20eb
......@@ -101,7 +101,7 @@ void ExtractorPostprocessor::processFlightTime(QVariant &flight, const char *tim
}
auto dt = JsonLdDocument::readProperty(flight, timePropName).toDateTime();
if (!dt.isValid() || dt.timeSpec() != Qt::LocalTime) {
if (!dt.isValid() || dt.timeSpec() == Qt::TimeZone) {
return;
}
......@@ -110,6 +110,16 @@ void ExtractorPostprocessor::processFlightTime(QVariant &flight, const char *tim
return;
}
// prefer our timezone over externally provided UTC offset, if they match
if (dt.timeSpec() == Qt::OffsetFromUTC && tz.offsetFromUtc(dt) != dt.offsetFromUtc()) {
return;
}
dt.setTimeSpec(Qt::TimeZone);
dt.setTimeZone(tz);
// if we updated from UTC offset to timezone spec here, QDateTime will compare equal
// and the auto-generated property code will not actually update the property
// so, clear the property first to force an update
JsonLdDocument::writeProperty(flight, timePropName, QDateTime());
JsonLdDocument::writeProperty(flight, timePropName, dt);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment