summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-01-05 01:27:09 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-01-05 01:27:09 +0100
commitbffd9a2ef7b132c2e0d394f3794605870236812c (patch)
tree70ae1cefc4dc7bb37f71cf4af509ad1a2d9875c9
parente39d7356cfa67fae4c629dd048824125df7114f4 (diff)
train input: support " (DD.MM.[YYYY])" and " @ DD.MM.[YYYY]" qualifiers
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 11f499b..9c09431 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -1960,7 +1960,13 @@ sub redirect_to_station {
}
}
- if ( $input =~ m{ ^ [a-zA-Z]{1,5} \s+ \d+ $ }x ) {
+ if ( $input =~ m{ ^ [a-zA-Z]{1,5} \s+ \d+ }x ) {
+ if ( $input =~ s{ \s* @ \s* (?<date> [0-9.]+) $ }{}x ) {
+ $params->param( date => $+{date} );
+ }
+ elsif ( $input =~ s{ \s* [(] \s* (?<date> [0-9.]+) \s* [)] $ }{}x ) {
+ $params->param( date => $+{date} );
+ }
$params = $params->to_string;
$self->redirect_to("/z/${input}?${params}");
}