Subject: | Template::Plugin::Date does not work with negative epoch times before 1970 |
See attached patch to solve problem with attempting to use negate epoch times with Template::Plugin::Date.
This code fails without the patch if the epoch date is pre-1970:
[% USE date( format = '%F' ) %]
[% date.format( time = -86400 ) %]
This code fails without the patch if the epoch date is pre-1970:
[% USE date( format = '%F' ) %]
[% date.format( time = -86400 ) %]
Subject: | p5-Template-Plugin-Date.pm.diff |
--- /usr/local/lib/perl5/site_perl/5.10.1/mach/Template/Plugin/Date.pm.orig 2009-06-30 18:57:55.000000000 +0000
+++ /usr/local/lib/perl5/site_perl/5.10.1/mach/Template/Plugin/Date.pm 2009-12-29 21:04:19.000000000 +0000
@@ -84,7 +84,7 @@
: ($params->{ gmt } || $self->{ gmt });
my (@date, $datestr);
- if ($time =~ /^\d+$/) {
+ if ($time =~ /^-?\d+$/) {
# $time is now in seconds since epoch
if ($gmt) {
@date = (gmtime($time))[0..6];