I am using Flowbite Datepick plugin with my Livewire and Livewire Component is not mounting value of the datepicker and is NULL upon selecting date
<div class="relative max-w-sm">
<label class="form-label mb-2 text-sm font-medium text-gray-900 dark:text-white" for="date_filed">{{ trans('cruds.leaveApplication.fields.date_filed') }}</label>
<div class="absolute py-2.5 left-0 flex items-center pl-3 pointer-events-none">
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path></svg>
</div>
<input datepicker datepicker-autohide type="text" wire:model="leaveApplication.date_filed" id="date_filed" name="date_filed" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Select date">
<div class="validation-message">
{{ $errors->first('leaveApplication.date_filed') }}
</div>
</div>
2
Answers
For thirty party javascript, livewire sometimes works not well. In this case, you can add a script like below:
And you can use wire:ignore to instructs Livewire to not update the element datepicker input:
I solved this problem in this way.
In the script I emit of function
updateDate
of Livewire usinglisteners
which are Livewire ownThis is a example
In this shape I get the value of the input of datepicker