Unverified Commit 0ea5ed8c authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

only run cross-midnight code if affected timestamps are present

parent 585a063f
Loading
Loading
Loading
Loading
+14 −10
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@ sub new {
		}
	}

	my $datetime_ref;

	if ( @{ $journey->{stopL} // [] } or $journey->{stbStop} ) {
		my $date_ref = ( split( qr{[|]}, $jid ) )[4];
		if ( length($date_ref) < 7 ) {
			warn("HAFAS, not even once -- midnight crossing may be bogus");
@@ -96,10 +99,11 @@ sub new {
		if ( length($date_ref) == 7 ) {
			$date_ref = "0${date_ref}";
		}
	my $datetime_ref = DateTime::Format::Strptime->new(
		$datetime_ref = DateTime::Format::Strptime->new(
			pattern   => '%d%m%Y',
			time_zone => 'Europe/Berlin'
		)->parse_datetime($date_ref);
	}

	my $class = $product->{cls};