diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-01-05 01:14:58 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-01-05 01:14:58 +0100 |
commit | e39d7356cfa67fae4c629dd048824125df7114f4 (patch) | |
tree | 0151581aebf2034421903651a7babfabd27f6552 /lib/DBInfoscreen/Controller | |
parent | e7f61e2f0486b3ce891d577907300c7d2f7f1a2e (diff) |
/z/:train: Add support for date=DD.MM.[YYYY] parameter
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 23a6ee2..11f499b 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1161,6 +1161,23 @@ sub train_details { $opt{language} = 'en'; } + if ( my $date = $self->param('date') ) { + if ( $date + =~ m{ ^ (?<day> \d{1,2} ) [.] (?<month> \d{1,2} ) [.] (?<year> \d{4})? $ }x + ) + { + $opt{datetime} = DateTime->now( time_zone => 'Europe/Berlin' ); + $opt{datetime}->set( + day => $+{day}, + month => $+{month} + ); + if ( $+{year} ) { + $opt{datetime}->set( year => $+{year} ); + } + say "set $opt{datetime}"; + } + } + $self->stash( hide_opts => 1 ); $self->render_later; |