Adds DateTimeInterface support for Formatter
This commit is contained in:
ivokund
2014-03-13 15:39:29 +02:00
parent 0013b608b6
commit f84de98efb

View File

@ -339,7 +339,7 @@ class Formatter extends Component
{
if (is_string($value)) {
return is_numeric($value) || $value === '' ? (int)$value : strtotime($value);
} elseif ($value instanceof DateTime) {
} elseif ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
return $value->getTimestamp();
} else {
return (int)$value;