diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-12-02 16:59:13 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-12-02 16:59:13 +0100 |
commit | 760af08f4a9997f8d30ccd6b93380d0c581fbcb5 (patch) | |
tree | c830468fa9e959976bb5326d5a96e2e08d4ddcea /lib/Travel/Status/DE/EFA/Stop.pm | |
parent | 7a0e702c107387754e10494eabf8205a408c01d3 (diff) |
Stop, Result: Replace date/time string accessors with datetime instances
Diffstat (limited to 'lib/Travel/Status/DE/EFA/Stop.pm')
-rw-r--r-- | lib/Travel/Status/DE/EFA/Stop.pm | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/Travel/Status/DE/EFA/Stop.pm b/lib/Travel/Status/DE/EFA/Stop.pm index daf0bbb..edde8bc 100644 --- a/lib/Travel/Status/DE/EFA/Stop.pm +++ b/lib/Travel/Status/DE/EFA/Stop.pm @@ -9,7 +9,7 @@ use parent 'Class::Accessor'; our $VERSION = '1.24'; Travel::Status::DE::EFA::Stop->mk_ro_accessors( - qw(arr_date arr_time dep_date dep_time name name_suf platform)); + qw(arr dep name name_suf platform)); sub new { my ( $obj, %conf ) = @_; @@ -39,7 +39,8 @@ in a Travel::Status::DE::EFA::Result's route for my $stop ($departure->route_post) { printf( "%s -> %s : %40s %s\n", - $stop->arr_time // q{ }, $stop->dep_time // q{ }, + $stop->arr ? $stop->arr->strftime('%H:%M') : q{--:--}, + $stop->dep ? $stop->dep->strftime('%H:%M') : q{--:--}, $stop->name, $stop->platform ); } @@ -60,21 +61,15 @@ delays or changed platforms are not taken into account. =over -=item $stop->arr_date +=item $stop->arr -arrival date (DD.MM.YYYY). undef if this is the first scheduled stop. +DateTime(3pm) object holding arrival date and time. undef if this is the +first scheduled stop. -=item $stop->arr_time +=item $stop->dep -arrival time (HH:MM). undef if this is the first scheduled stop. - -=item $stop->dep_date - -departure date (DD.MM.YYYY). undef if this is the final scehduled stop. - -=item $stop->dep_time - -departure time (HH:MM). undef if this is the final scehduled stop. +DateTime(3pm) object holding departure date and time. undef if this is the +final scheduled stop. =item $stop->name |