diff --git a/app/Http/Controllers/VolunteerController.php b/app/Http/Controllers/VolunteerController.php index 9b49b49..23083b4 100644 --- a/app/Http/Controllers/VolunteerController.php +++ b/app/Http/Controllers/VolunteerController.php @@ -93,8 +93,7 @@ public function checkOut(Request $request, TimeEntry $timeEntry): JsonResponse|R */ public function storeTimeEntry(TimeEntryStoreRequest $request, Event $event, User $user): JsonResponse { // Don't allow an ongoing entry to be created if there already is one - $input = $request->safe(); - if (!isset($input['stop'])) { + if (!$request->filled('stop')) { if ($user->timeEntries()->ongoing()->forEvent($event)->exists()) { return response()->json(['error' => 'User already has an ongoing time entry.'], 409); } diff --git a/app/Http/Requests/TimeEntryStoreRequest.php b/app/Http/Requests/TimeEntryStoreRequest.php index 83b759d..ad055c4 100644 --- a/app/Http/Requests/TimeEntryStoreRequest.php +++ b/app/Http/Requests/TimeEntryStoreRequest.php @@ -43,8 +43,13 @@ public function rules(): array { */ public function passedValidation(): void { $this->merge([ - 'start' => $this->date('start')?->timezone(config('app.timezone')) ?? now(), - 'stop' => $this->date('stop')?->timezone(config('app.timezone')), + 'start' => ($this->date('start')?->timezone(config('app.timezone')) ?? now())->toISOString(true), + 'stop' => $this->date('stop')?->timezone(config('app.timezone'))?->toISOString(true), ]); + + $this->validator->setData(array_merge($this->validator->getData(), [ + 'start' => $this->input('start'), + 'stop' => $this->input('stop'), + ])); } }