diff options
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Journey.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm index d9c1be1..b849cb3 100644 --- a/lib/Travel/Status/DE/HAFAS/Journey.pm +++ b/lib/Travel/Status/DE/HAFAS/Journey.pm @@ -89,7 +89,13 @@ sub new { } } - my $date_ref = ( split( qr{[|]}, $jid ) )[4]; + my $date_ref = ( split( qr{[|]}, $jid ) )[4]; + if ( length($date_ref) < 7 ) { + warn("HAFAS, not even once -- midnight crossing may be bogus"); + } + if ( length($date_ref) == 7 ) { + $date_ref = "0${date_ref}"; + } my $datetime_ref = DateTime::Format::Strptime->new( pattern => '%d%m%Y', time_zone => 'Europe/Berlin' |