You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have a variable (say "my_timestamp") containing an integer timestamp, the following {{ my_timestamp | date }} does not work (it always displays Jan 1 1970).
The current code for this filter passes integers to strtotime, but that returns FALSE for integer input (at least on my system, php 5.3).
static function date($time, $format = ’jS F Y H:i’) {
if ($time instanceof DateTime)
$time = (int) $time->format(’U’);
return date($format, strtotime($time));
}
I would suggest this should be:
static function date($time, $format = ’jS F Y H:i’) {
if ($time instanceof DateTime)
$time = (int) $time->format(’U’);
if (!is_numeric($time)) $time = strtotime($time);
return date($format, $time);
Hi there...
If I have a variable (say "my_timestamp") containing an integer timestamp, the following {{ my_timestamp | date }} does not work (it always displays Jan 1 1970).
The current code for this filter passes integers to strtotime, but that returns FALSE for integer input (at least on my system, php 5.3).
static function date($time, $format = ’jS F Y H:i’) {
if ($time instanceof DateTime)
$time = (int) $time->format(’U’);
}
I would suggest this should be:
static function date($time, $format = ’jS F Y H:i’) {
if ($time instanceof DateTime)
$time = (int) $time->format(’U’);
}
original LH ticket
This ticket has 0 attachment(s).
The text was updated successfully, but these errors were encountered: