Skip to content

Commit

Permalink
allow the date plugin to accept dates with the ISO8601 "T" separator,
Browse files Browse the repository at this point in the history
like 2001-09-30T12:31:31
  • Loading branch information
kgoess committed Jun 27, 2012
1 parent 45061fb commit acc7a99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Template/Plugin/Date.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ sub format {
# otherwise, we try to parse it as either a 'Y:M:D H:M:S' or a # otherwise, we try to parse it as either a 'Y:M:D H:M:S' or a
# 'H:M:S D:M:Y' string # 'H:M:S D:M:Y' string


my @parts = (split(/(?:\/| |:|-)/, $time)); my @parts = (split(/\D/, $time));


if (@parts >= 6) { if (@parts >= 6) {
if (length($parts[0]) == 4) { if (length($parts[0]) == 4) {
Expand Down
7 changes: 7 additions & 0 deletions t/date.t
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -261,3 +261,10 @@ not testing
-%] -%]
-- expect -- -- expect --
12:59 12:59
-- test --
[% USE date;
date.format('2001/09/30T12:59:00', '%H:%M')
-%]
-- expect --
12:59

0 comments on commit acc7a99

Please sign in to comment.