Permalink
Browse files

Merge pull request #57 from hirose31/feature/also-accept-date-str

Additionaly accept date string as value of "time" when adding vrule
  • Loading branch information...
2 parents 0e7d0a8 + b3377be commit a85e4c894bbd12cc0fa584aba383922e2ce720d2 @kazeburo committed Mar 5, 2014
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/GrowthForecast/Web.pm
@@ -1182,7 +1182,14 @@ sub add_vrule {
'time' => {
default => time(),
rule => [
- ['INT', 'a INT number is required for "time"']
+ [sub {
+ if ($_[1] !~ /\A[1-9][0-9]*\z/) {
+ my $t = HTTP::Date::str2time($_[1])
+ or return;
+ $_[1] = $t;
+ }
+ return 1;
+ }, 'epoch time or date string is required for "time"'],
],
},
'color' => {

0 comments on commit a85e4c8

Please sign in to comment.