Skip to content

Commit 6a989cc

Browse files
committed
fix date parsing in filters
1 parent e7708e4 commit 6a989cc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/RequestQueryParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function parseFilters(Request $request): void
3434
{
3535
if ($request->has('filter')) {
3636
foreach ($request->get('filter') as $filter) {
37-
$filterDatas = explode(':', $filter);
37+
$filterDatas = explode(':', $filter, 3);
3838

3939
if (count($filterDatas) < 3) {
4040
throw new UnprocessableEntityHttpException('Filter must contains field and value!');

tests/AbstractQueryParserTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ public function goodRequests(): array
5858
],
5959
[
6060
new Request([
61-
'filter' => ['email:ew:@gmail.com'],
61+
'filter' => ['email:ew:@gmail.com', 'createdAt:eq:2018-07-2017:06:41'],
6262
'sort' => ['updated:ASC'],
6363
'limit' => 50,
6464
'page' => 11,
6565
'connection' => ['profile'],
6666
]),
6767
[
68-
'filters' => [['field' => 'email', 'operator' => 'ew', 'value' => '@gmail.com']],
68+
'filters' => [
69+
['field' => 'email', 'operator' => 'ew', 'value' => '@gmail.com'],
70+
['field' => 'createdAt', 'operator' => 'eq', 'value' => '2018-07-2017:06:41']
71+
],
6972
'sorts' => [['field' => 'updated', 'direction' => 'ASC']],
7073
'limit' => 50,
7174
'page' => 11,

0 commit comments

Comments
 (0)