From 3a7769f869114abb78b1e58f4a5845cb10b1f93b Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 10 Nov 2021 17:00:00 +0100 Subject: [PATCH] wait #4865 @0.5 --- src/app/Magic/Fields/Field.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index ea187f6..7e59388 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -264,8 +264,14 @@ class Field implements \ArrayAccess $crud->addClause('whereIn', $name, json_decode($value)); } else if ($type === 'date_range') { $dates = json_decode($value); - $crud->addClause('where', $name, '>=', trim($dates->from)); - $crud->addClause('where', $name, '<=', trim($dates->to)); + if (null !== $dates) { + if ($dates->from) { + $crud->addClause('where', $name, '>=', trim($dates->from)); + } + if ($dates->to) { + $crud->addClause('where', $name, '<=', trim($dates->to)); + } + } } } @@ -322,7 +328,8 @@ class Field implements \ArrayAccess } } - public function getDatabaseLength(){ + public function getDatabaseLength() + { return $this->getAttribute('database_length'); } -- 2.39.5