diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-26 18:25:24 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-26 18:25:44 +0100 |
commit | b2aefe0c6ec267409e17a1ae59316ffb3adb0dae (patch) | |
tree | 2fb21276411220e10f63d5fa0db1de1a71e0f6d3 /lib/Travel/Status | |
parent | 4d6c7ca4a3ac0e44b2324aeebf6470d6650765fa (diff) |
Support station board requests for custom datetimes
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS.pm | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Travel/Status/DE/DBRIS.pm b/lib/Travel/Status/DE/DBRIS.pm index 6221622..3b25862 100644 --- a/lib/Travel/Status/DE/DBRIS.pm +++ b/lib/Travel/Status/DE/DBRIS.pm @@ -33,7 +33,6 @@ sub new { $ua->env_proxy; } - my $now = DateTime->now( time_zone => 'Europe/Berlin' ); my $self = { cache => $conf{cache}, developer_mode => $conf{developer_mode}, @@ -41,8 +40,6 @@ sub new { results => [], station => $conf{station}, ua => $ua, - now => $now, - tz_offset => $now->offset / 60, }; bless( $self, $obj ); @@ -50,13 +47,14 @@ sub new { my $req; if ( my $station = $conf{station} ) { - my $now = DateTime->now( time_zone => 'Europe/Berlin' ); + my $dt = $conf{datetime} + // DateTime->now( time_zone => 'Europe/Berlin' ); $req = 'https://www.bahn.de/web/api/reiseloesung/abfahrten' . '?datum=' - . $now->strftime('%Y-%m-%d') + . $dt->strftime('%Y-%m-%d') . '&zeit=' - . $now->strftime('%H:%M:00') + . $dt->strftime('%H:%M:00') . '&ortExtId=' . $station->{eva} . '&ortId=' |