Commit ecccdc1b authored by Volker Krause's avatar Volker Krause
Browse files

Try harder to find the first day of validity on RCT2 tickets

This handles the case that the first day of validity RCT2 field only
contains a year, but the leg data contains days/times and wildcard
destinations.
parent 268e3ef8
Pipeline #203671 failed with stage
in 8 minutes and 3 seconds
......@@ -188,7 +188,13 @@ QDateTime Uic9183Parser::validFrom() const
// RCT2
if (const auto rct2 = rct2Ticket(); rct2.isValid()) {
return QDateTime(rct2.firstDayOfValidity(), {0, 0, 0});
const auto dt = rct2.firstDayOfValidity();
if (dt.month() != 1 || dt.day() != 1 || !rct2.outboundDepartureStation().isEmpty()) {
return QDateTime(dt, {0, 0, 0});
}
// firstDayOfValidity is just a year, and we have wildcard station names
const auto dep = rct2.outboundDepartureTime();
return dep.isValid() ? dep : QDateTime(dt, {0, 0, 0});
}
return {};
......
Supports Markdown
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