Parsing fix for searching on DateFields

This commit is contained in:
Jeremy Roundill 2014-11-11 19:44:06 +13:00
parent fb14d95eb1
commit 729e8ea3e1

View File

@ -227,6 +227,14 @@ abstract class ModelAdmin extends LeftAndMain {
public function getList() {
$context = $this->getSearchContext();
$params = $this->request->requestVar('q');
// Parse all DateFields to handle user input non ISO 8601 dates
foreach(singleton($this->modelClass)->getDefaultSearchContext()->getFields() as $field) {
if($field->Type() == "date text") {
$params[$field->getName()] = date('Y-m-d', strtotime($params[$field->getName()]));
}
}
$list = $context->getResults($params);
$this->extend('updateList', $list);