Commit 7f17fca2 authored by Volker Krause's avatar Volker Krause

Be a bit less strict when applying the year from the context date

This avoids dates jumping one year into the future for documents produced
where close to the begin of the journey, or even during the journey.
parent fd5c8270
Pipeline #38856 passed with stage
in 9 minutes and 8 seconds
......@@ -197,7 +197,9 @@ QDateTime JsApi::JsonLd::toDateTime(const QString &dtStr, const QString &format,
// if the date does not contain a year number, determine that based on the context date, if set
else if (!hasYear && m_contextDate.isValid()) {
dt.setDate({m_contextDate.date().year(), dt.date().month(), dt.date().day()});
if (dt < m_contextDate) {
// go one day back to leave a bit of room for documents produced very close to
// or even during the trip
if (dt < m_contextDate.addDays(-1)) {
dt = dt.addYears(1);
}
}
......
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