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:
2026-11-30 10:47:01 +02:00
co-authored by Claude Opus 5.5
parent f24bd3cc35
commit 38c5b43018
5 changed files with 35 additions and 5 deletions
@@ -166,3 +166,13 @@ it('keeps subcontractors to their own jobs and blocks removing tasks with hours'
$this->actingAs(User::factory()->subcontractor()->create());
$this->get(route('time.task', $this->task->id))->assertForbidden();
});
it('counts the hours of Sunday in the week', function () {
$sunday = now()->startOfWeek()->addDays(6)->toDateString();
TimeEntryModel::factory()->create(['task_id' => $this->task->id, 'user_id' => $this->employee->id, 'worked_on' => $sunday, 'hours' => 2]);
$sheet = Livewire::test('time::week')->instance()->sheet;
expect($sheet->totalQuarters)->toBe(8)
->and($sheet->dayTotals[$sunday])->toBe(8);
});