Skip to content

Commit

Permalink
Added Capability to format DateInterval via twig date filter
Browse files Browse the repository at this point in the history
  • Loading branch information
phiamo committed Sep 29, 2011
1 parent f96d8d8 commit 5fa0094
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Twig/Extension/Core.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function twig_cycle($values, $i)
*/ */
function twig_date_format_filter($date, $format = 'F j, Y H:i', $timezone = null) function twig_date_format_filter($date, $format = 'F j, Y H:i', $timezone = null)
{ {
if (!$date instanceof DateTime) { if (!$date instanceof DateTime && !$date instanceof DateInterval) {
if (ctype_digit((string) $date)) { if (ctype_digit((string) $date)) {
$date = new DateTime('@'.$date); $date = new DateTime('@'.$date);
$date->setTimezone(new DateTimeZone(date_default_timezone_get())); $date->setTimezone(new DateTimeZone(date_default_timezone_get()));
Expand Down

0 comments on commit 5fa0094

Please sign in to comment.