change data before create/edit actions on modal

Hey guys so I have a resource that uses a modal to perform the create and edit actions and I have two datepickers (start_date and end_date) and they work ok but I want to when I persist the changes I want that start_date starts at the beginning of the day and end_date at end of day. I saw that I can change the handleRecordUpdate but only works when I have the create or edit page created. Thanks in advance
Solution:
fixed using dehydrateStateUsing on the form method like:
->dehydrateStateUsing(fn (string $state): string => Carbon::parse($state)->startOfDay()->toISOString())
->dehydrateStateUsing(fn (string $state): string => Carbon::parse($state)->startOfDay()->toISOString())
...
Jump to solution
1 Reply
Solution
Bruno Pereira
Bruno Pereira2y ago
fixed using dehydrateStateUsing on the form method like:
->dehydrateStateUsing(fn (string $state): string => Carbon::parse($state)->startOfDay()->toISOString())
->dehydrateStateUsing(fn (string $state): string => Carbon::parse($state)->startOfDay()->toISOString())

Did you find this page helpful?