Include the last day of a date range in expense and time entry queries
SQLite stores date casts as "Y-m-d 00:00:00", so a between ending at "Y-m-d" left out the month's last day and the week's Sunday (the own expenses test failed on the 30th). Ranges now end before the next day. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+6
-3
@@ -42,7 +42,8 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
|
||||
|
||||
$entries = TimeEntryModel::query()
|
||||
->where('user_id', $userId)
|
||||
->whereBetween('worked_on', [$days[0], $days[6]])
|
||||
->where('worked_on', '>=', $days[0])
|
||||
->where('worked_on', '<', CarbonImmutable::parse($days[6])->addDay()->toDateString())
|
||||
->get();
|
||||
$pinnedIds = $this->pins->pinnedTaskIds($userId);
|
||||
$scheduledIds = $this->tasks->scheduledTaskIdsFor($userId, $days[0], $days[6]);
|
||||
@@ -100,7 +101,8 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
|
||||
$start = CarbonImmutable::createFromFormat('!Y-m', $month) ?: CarbonImmutable::now()->startOfMonth();
|
||||
$entries = TimeEntryModel::query()
|
||||
->where('user_id', $userId)
|
||||
->whereBetween('worked_on', [$start->toDateString(), $start->endOfMonth()->toDateString()])
|
||||
->where('worked_on', '>=', $start->toDateString())
|
||||
->where('worked_on', '<', $start->addMonth()->toDateString())
|
||||
->get();
|
||||
$paymentBases = [];
|
||||
|
||||
@@ -135,7 +137,8 @@ class EloquentTimeEntryQueries implements TimeEntryQueries
|
||||
|
||||
$entries = TimeEntryModel::query()
|
||||
->where('user_id', $userId)
|
||||
->whereBetween('worked_on', [$days[0], $days[6]])
|
||||
->where('worked_on', '>=', $days[0])
|
||||
->where('worked_on', '<', CarbonImmutable::parse($days[6])->addDay()->toDateString())
|
||||
->get();
|
||||
|
||||
$taskIds = array_values(array_unique(array_merge(
|
||||
|
||||
Reference in New Issue
Block a user