From cbbdf22f17eff7a717546eef136a0979a7b20c70 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 5 Jun 2020 22:01:32 +0200 Subject: Support backends which recently switched to 4-digit years What a time to be alive! --- lib/Travel/Status/DE/HAFAS.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm index 39621d5..847be90 100644 --- a/lib/Travel/Status/DE/HAFAS.pm +++ b/lib/Travel/Status/DE/HAFAS.pm @@ -328,7 +328,11 @@ sub results { push( @messages, $n->getAttribute('header') ); } - substr( $date, 6, 0, '20' ); + # Some backends report dd.mm.yy, some report dd.mm.yyyy + # -> map all dates to dd.mm.yyyy + if ( length($date) == 8 ) { + substr( $date, 6, 0, '20' ); + } # TODO the first charactor of delayReason is special: # " " -> no additional data, rest (if any) is delay reason -- cgit v1.2.3