you need state for each of the elements, then when any changes, update the date_of_birth
Modifying State in UpdateUserProfile Livewire
Hi, I've got a piece of state in my UpdateProfileInformationForm component which is a new field I've set up for Date of birth. This is standard date in the format Y-m-d, the name of this is date_of_birth. The issue I have is that in my View the Day/Month/Year are separate fields. So accessing state.date_of_birth is no good to me. Here is my Month field for example from my update-profile-information-form.blade.php:
<div class="inline-block">
<x-jet-label class="text-xs" for="dob-month" value="{{ __('Month') }}" />
<x-jet-input id="dob-month" type="number" class="mt-1 block w-[3.5rem] text-center" wire:model.defer="state.date_of_birth_month" autocomplete="dob-month" placeholder="MM" pattern="[0-9]+" maxlength="2" oninput="this.value = window.isNum(this.value, 12) ;" />
</div>
Obviously this doesn't work because state.date_of_birth_month doesn't exist currently - but how do I split date_of_birth into 3 parts in order to get it into the view - which files do I need to modify?
You should be able to duplicate the original component to your own component and then in FortifyServiceProvider, swap the implementation
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
But extending might work also.
Please or to participate in this conversation.