diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index 2a807059c..b73289ac2 100644 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -213,12 +213,12 @@ abstract class ModelAdmin extends LeftAndMain { if(is_array($params)) { $params = ArrayLib::array_map_recursive('trim', $params); - } - // Parse all DateFields to handle user input non ISO 8601 dates - foreach($context->getFields() as $field) { - if($field instanceof DatetimeField) { - $params[$field->getName()] = date('Y-m-d', strtotime($params[$field->getName()])); + // Parse all DateFields to handle user input non ISO 8601 dates + foreach($context->getFields() as $field) { + if($field instanceof DatetimeField && !empty($params[$field->getName()])) { + $params[$field->getName()] = date('Y-m-d', strtotime($params[$field->getName()])); + } } }