From e5f8f254ddc03a16279a862e4589628983fa10c6 Mon Sep 17 00:00:00 2001 From: Djonathan Date: Fri, 8 Jul 2022 16:21:44 -0300 Subject: [PATCH] Bring date only from current year + previous year in the filter. --- app/Support/FilterBuilder/Entity/FilterItem.php | 2 +- app/Support/FilterBuilder/FilterType.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Support/FilterBuilder/Entity/FilterItem.php b/app/Support/FilterBuilder/Entity/FilterItem.php index 93f6969..4e34d7e 100644 --- a/app/Support/FilterBuilder/Entity/FilterItem.php +++ b/app/Support/FilterBuilder/Entity/FilterItem.php @@ -34,7 +34,7 @@ class FilterItem extends EntityJson /** * @var string */ - protected string $interval; + protected string $interval = ''; /** * @return bool diff --git a/app/Support/FilterBuilder/FilterType.php b/app/Support/FilterBuilder/FilterType.php index 8198530..0f7069b 100644 --- a/app/Support/FilterBuilder/FilterType.php +++ b/app/Support/FilterBuilder/FilterType.php @@ -63,7 +63,7 @@ class FilterType $fType = 'not like'; } - if ($filter->getInterval()) + if (!empty($filter->getInterval())) { $filter->setField("TO_DATE({$filter->getField()}, 'YYMM')"); $filter->setValue(DB::raw("TO_DATE(TO_CHAR(current_date , 'YYYY-01-01'), 'YYYY-MM-DD') - INTERVAL