From 7ac6d22b4faee90e98589fb827708a84f6e77bfc Mon Sep 17 00:00:00 2001 From: Cassidy Dingenskirchen Date: Sun, 29 Jun 2025 16:47:53 +0200 Subject: /history/map: date inputs --- lib/Travelynx/Controller/Traveling.pm | 8 +++----- templates/history_map.html.ep | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 4c58c0e..5ecfcc0 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -1745,13 +1745,12 @@ sub map_history { my $with_polyline = $route_type eq 'beeline' ? 0 : 1; my $parser = DateTime::Format::Strptime->new( - pattern => '%d.%m.%Y', + pattern => '%F', locale => 'de_DE', time_zone => 'Europe/Berlin' ); - if ( $filter_from - and $filter_from =~ m{ ^ (\d+) [.] (\d+) [.] (\d+) $ }x ) + if ( $filter_from ) { $filter_from = $parser->parse_datetime($filter_from); } @@ -1759,8 +1758,7 @@ sub map_history { $filter_from = undef; } - if ( $filter_until - and $filter_until =~ m{ ^ (\d+) [.] (\d+) [.] (\d+) $ }x ) + if ( $filter_until ) { $filter_until = $parser->parse_datetime($filter_until)->set( hour => 23, diff --git a/templates/history_map.html.ep b/templates/history_map.html.ep index c2ff9ed..6620cb2 100644 --- a/templates/history_map.html.ep +++ b/templates/history_map.html.ep @@ -88,14 +88,14 @@

- %= text_field 'filter_from', id => 'filter_from', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9]( +[0-9][0-9]:[0-9][0-9])?' - + %= date_field 'filter_from', id => 'filter_from', class => 'validate' +
- %= text_field 'filter_to', id => 'filter_to', class => 'validate', pattern => '[0-9][0-9]?[.][0-9][0-9]?[.][0-9][0-9][0-9][0-9]( +[0-9][0-9]:[0-9][0-9])?' - + %= date_field 'filter_to', id => 'filter_to', class => 'validate' +
-- cgit v1.2.3