Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: KGOESS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 2.24
Fixed in: (no value)



Subject: Plugin::Date to accept "T" in ISO8601 dates
It would nice if Plugin::Date could accept dates with a "T" as the separator like ISO8601 dates: 2012-09-30T12:59:00 http://en.wikipedia.org/wiki/ISO_8601 Patch is attached.
Subject: accept-T-in-dates.patch
--- lib/Template/Plugin/Date.pm.orig 2012-06-27 09:40:47.048774867 +0200 +++ lib/Template/Plugin/Date.pm 2012-06-27 09:40:50.816774945 +0200 @@ -96,11 +96,11 @@ else { # if $time is numeric, then we assume it's seconds since the epoch # otherwise, we try to parse it as either a 'Y:M:D H:M:S' or a # 'H:M:S D:M:Y' string - my @parts = (split(/(?:\/| |:|-)/, $time)); + my @parts = (split(/\D/, $time)); if (@parts >= 6) { if (length($parts[0]) == 4) { # year is first; assume 'Y:M:D H:M:S' @date = @parts[reverse 0..5]; --- t/date.t.orig 2012-06-27 09:38:07.196771596 +0200 +++ t/date.t 2012-06-27 09:38:10.100771656 +0200 @@ -259,5 +259,12 @@ [% USE date; date.format('2001/09/30 12:59:00', '%H:%M') -%] -- expect -- 12:59 + +-- test -- +[% USE date; + date.format('2001/09/30T12:59:00', '%H:%M') +-%] +-- expect -- +12:59
Ticket migrated to github as https://github.com/abw/Template2/issues/113