mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Parsing fix for searching on DateFields
This commit is contained in:
parent
fb14d95eb1
commit
729e8ea3e1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user