Commit f84de98e by ivokund

Fixes #2735

Adds DateTimeInterface support for Formatter
parent 0013b608
...@@ -339,7 +339,7 @@ class Formatter extends Component ...@@ -339,7 +339,7 @@ class Formatter extends Component
{ {
if (is_string($value)) { if (is_string($value)) {
return is_numeric($value) || $value === '' ? (int)$value : strtotime($value); return is_numeric($value) || $value === '' ? (int)$value : strtotime($value);
} elseif ($value instanceof DateTime) { } elseif ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
return $value->getTimestamp(); return $value->getTimestamp();
} else { } else {
return (int)$value; return (int)$value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment