summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/HAFAS.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-06-05 22:01:32 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-06-05 22:01:32 +0200
commitcbbdf22f17eff7a717546eef136a0979a7b20c70 (patch)
treecfec3c9ba9674f42ad24a224fcb9a7bf2fbd8421 /lib/Travel/Status/DE/HAFAS.pm
parent10750ae5d92f19b264fe0793659a146c3b1d6c14 (diff)
Support backends which recently switched to 4-digit years
What a time to be alive!
Diffstat (limited to 'lib/Travel/Status/DE/HAFAS.pm')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm6
1 files changed, 5 insertions, 1 deletions
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