Commit 7d8dfe52 by Qiang Xue

Fixed test break.

parent 074fd809
...@@ -352,7 +352,11 @@ class Formatter extends Component ...@@ -352,7 +352,11 @@ class Formatter extends Component
if (is_numeric($value) || $value === '') { if (is_numeric($value) || $value === '') {
$value = (double)$value; $value = (double)$value;
} else { } else {
try {
$date = new DateTime($value); $date = new DateTime($value);
} catch (\Exception $e) {
return false;
}
$value = $date->format('U'); $value = $date->format('U');
} }
return $value; return $value;
...@@ -506,7 +510,7 @@ class Formatter extends Component ...@@ -506,7 +510,7 @@ class Formatter extends Component
// to create a DateInterval with it // to create a DateInterval with it
try { try {
$interval = new \DateInterval($value); $interval = new \DateInterval($value);
} catch (Exception $e) { } catch (\Exception $e) {
// invalid date/time and invalid interval // invalid date/time and invalid interval
return $this->nullDisplay; return $this->nullDisplay;
} }
......
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