summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-10-29 22:59:03 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-10-29 22:59:03 +0200
commit79ad2692d0871d7b6f6e8278748c29351cd39811 (patch)
tree4c527df0ae6a4cbff9b48bb77cec3d741931ec5a
parentd900bfc9f17eea5b0d2439e976609aeb2be85e25 (diff)
Use strptime for date parsing (support daychange)
-rwxr-xr-xBuild.PL2
-rw-r--r--cgi/index.pl15
2 files changed, 14 insertions, 3 deletions
diff --git a/Build.PL b/Build.PL
index b42ae31..fd0fa93 100755
--- a/Build.PL
+++ b/Build.PL
@@ -18,7 +18,7 @@ Module::Build->new(
'perl' => '5.10.0',
'Cache::File' => 0,
'DateTime' => 0,
- 'DateTime::Format::DateParse' => 0,
+ 'DateTime::Format::Strptime' => 0,
'GD' => 0,
'Mojolicious::Lite' => 0,
'Travel::Status::DE::VRR' => 0.02,
diff --git a/cgi/index.pl b/cgi/index.pl
index dd5e875..678faae 100644
--- a/cgi/index.pl
+++ b/cgi/index.pl
@@ -3,7 +3,7 @@ use Mojolicious::Lite;
use Cache::File;
use DateTime;
-use DateTime::Format::DateParse;
+use DateTime::Format::Strptime;
use App::VRR::Fakedisplay;
use Travel::Status::DE::VRR;
@@ -88,6 +88,16 @@ sub render_image {
my $png = App::VRR::Fakedisplay->new(width => 180, height => 50, color => [split(qr{,}, $color)]);
+ my $strp_simple = DateTime::Format::Strptime->new(
+ pattern => '%H:%M',
+ time_zone => 'floating',
+ );
+ my $strp_full = DateTime::Format::Strptime->new(
+ pattern => '%d.%m.%Y %H:%M',
+ time_zone => 'floating',
+ );
+
+
if ($self->param('line')) {
@grep_line = split(qr{,}, $self->param('line'));
}
@@ -104,7 +114,8 @@ sub render_image {
my $time = $d->time;
my $etr;
- my $dt_dep = DateTime::Format::DateParse->parse_datetime($time, 'floating');
+ my $dt_dep = $strp_simple->parse_datetime($time)
+ // $strp_full->parse_datetime($time);
my $dt;
if ((@grep_line and not ($line ~~ \@grep_line)) or