Skip to content

Commit 4f1e8b2

Browse files
committed
Update whereDate
1 parent fdf0248 commit 4f1e8b2

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/Query/Builder.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,16 +1202,10 @@ protected function compileWhereDate(array $where): array
12021202
],
12031203
],
12041204
'ne' => [
1205-
'$or' => [
1206-
[
1207-
$where['column'] => [
1208-
'$lt' => $startOfDay,
1209-
],
1210-
],
1211-
[
1212-
$where['column'] => [
1213-
'$gt' => $endOfDay,
1214-
],
1205+
$where['column'] => [
1206+
'$not' => [
1207+
'$gte' => $startOfDay,
1208+
'$lte' => $endOfDay,
12151209
],
12161210
],
12171211
],

tests/QueryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function testWhereDate(): void
220220
$this->assertCount(2, $birthdayCount);
221221

222222
$birthdayCount = Birthday::whereDate('birthday', '<>', '2021-05-11')->get();
223-
$this->assertCount(5, $birthdayCount);
223+
$this->assertCount(6, $birthdayCount);
224224
}
225225

226226
public function testWhereDay(): void

0 commit comments

Comments
 (0)