From f62f2df78ff3d90b748aeb0c1f031222ad66658d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volf=20Tom=C3=A1=C5=A1?= Date: Wed, 5 Apr 2017 21:29:20 +0200 Subject: [PATCH] Reverse conversion to DateTime object from array of datetime values (as filter param) --- src/TwiGrid/DataGrid.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/TwiGrid/DataGrid.php b/src/TwiGrid/DataGrid.php index 4d1088b..fb93d38 100644 --- a/src/TwiGrid/DataGrid.php +++ b/src/TwiGrid/DataGrid.php @@ -189,6 +189,12 @@ public function loadState(array $params) $this->polluted = TRUE; } } + + foreach ($this->filters AS $fKey => $fValue) { + if (isset($fValue['date']) && isset($fValue['timezone_type']) && isset($fValue['timezone'])) { + $this->filters[$fKey] = new \DateTime($fValue['date'], new \DateTimeZone($fValue['timezone'])); + } + } $i = 0; foreach ($this->orderBy as $column => $dir) {