summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Travel/Status/DE/IRIS.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index 51b0051..e4a8dba 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -64,9 +64,12 @@ sub new {
$self->get_realtime;
- @{ $self->{results} }
- = grep { ( $_->departure // $_->arrival ) >= $self->{datetime} }
- @{ $self->{results} };
+ @{ $self->{results} } = grep {
+ my $d
+ = ( $_->departure // $_->arrival )
+ ->subtract_datetime( $self->{datetime} );
+ not $d->is_negative and $d->in_units('hours') < 4
+ } @{ $self->{results} };
@{ $self->{results} }
= sort { $a->{datetime} <=> $b->{datetime} } @{ $self->{results} };