Commit 6e32fae3 by Qiang Xue

Fixes #763: handling empty string for date formatting.

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