Permalink
Browse files

allow timestamp being a string for date/time formatting

  • Loading branch information...
1 parent 346ec67 commit 7501b939800cd7123a832ec6b6be10e17c3bad14 @craue committed Apr 16, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 Twig/Extension/FormatDateTimeExtension.php
@@ -151,6 +151,8 @@ protected function getFormattedDateTime($value, $locale, $datetype, $timetype) {
if ($valueToUse instanceof \DateTime) {
// \DateTime::getTimestamp() would return false for year > 2038 on 32-bit systems (https://bugs.php.net/bug.php?id=50590)
$valueToUse = floatval($valueToUse->format('U'));
+ } elseif (is_string($valueToUse)) {
+ $valueToUse = floatval($valueToUse);
}
$localeToUse = !empty($locale) ? $locale : $this->getLocale();

0 comments on commit 7501b93

Please sign in to comment.