We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7784c16 commit 55dabf8Copy full SHA for 55dabf8
src/Traits/WithFilters.php
@@ -2,6 +2,7 @@
2
3
namespace Rappasoft\LaravelLivewireTables\Traits;
4
5
+use DateTime;
6
use Illuminate\Database\Eloquent\Builder;
7
use Illuminate\Database\Eloquent\Relations\Relation;
8
use Rappasoft\LaravelLivewireTables\Utilities\ColumnUtilities;
@@ -150,7 +151,11 @@ public function cleanFilters(): void
150
151
}
152
153
if ($filterDefinitions[$filterName]->isDate()) {
- return true;
154
+ // array_sum trick is a terse way of ensuring that PHP
155
+ // did not do "month shifting"
156
+ // (e.g. consider that January 32 is February 1)
157
+ $dt = DateTime::createFromFormat("Y-m-d", $filterValue);
158
+ return $dt !== false && !array_sum($dt::getLastErrors());
159
160
161
return false;
0 commit comments