Commit 6e32fae3 by Qiang Xue

Fixes #763: handling empty string for date formatting.

parent 01ace04b
...@@ -314,11 +314,7 @@ class Formatter extends Component ...@@ -314,11 +314,7 @@ class Formatter extends Component
protected function normalizeDatetimeValue($value) protected function normalizeDatetimeValue($value)
{ {
if (is_string($value)) { if (is_string($value)) {
if (ctype_digit($value) || $value[0] === '-' && ctype_digit(substr($value, 1))) { return is_numeric($value) ? (int)$value : strtotime($value);
return (int)$value;
} else {
return strtotime($value);
}
} elseif ($value instanceof DateTime) { } elseif ($value instanceof DateTime) {
return $value->getTimestamp(); return $value->getTimestamp();
} else { } else {
......
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