0
votes

I seem to be having a problem in regards to laravel livewire and alpine JS. I currently have a datetime picker (using Tailwind CSS & AlpineJS) created and somehow the selected date value does not transfer to its public wire:model (refDate) variable thus it is always null and empty. Here's a snippet of the front end code.

 <input type="hidden" name="date" x-ref="date">
 <input wire:model="refDate" id="reference_date" type="text" x-model="datepickerValue" @click="showDatepicker = !showDatepicker" @keydown.escape="showDatepicker = false" class="w-full border border-gray-300 rounded-md text-gray-600 h-10 bg-white hover:border-gray-400 focus:outline-none appearance-none" placeholder="Select date">

I've based my datetimepicker with one of the existing components in tailwindcss (https://tailwindcomponents.com/component/datepicker-with-tailwindcss-and-alpinejs) Let me know your thoughts and what are the possible solutions for linking it to the livewire model. Thank You.

1

1 Answers

0
votes

I had the same issue and ended up firing a livewire event from javascript to force the component set the public picked date property. Not elegant, but it works for me.