Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 53451
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: sailorfred [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.22
Fixed in: (no value)



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 ) %]
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];
From: amedico [...] ciphertech.us
I'm also running into this problem. It would be helpful to have the patch applied to the official distribution.