Skip to content

Instantly share code, notes, and snippets.

@humayunjavaid
Created September 29, 2022 12:18
Show Gist options
  • Save humayunjavaid/ed21c713e04034d0d64ceaa74ca540a9 to your computer and use it in GitHub Desktop.
Save humayunjavaid/ed21c713e04034d0d64ceaa74ca540a9 to your computer and use it in GitHub Desktop.
Pickaday Integration with Laravel Livewire And Alpine js
<div
x-data="{ value : @entangle($attributes->wire('model')) }"
x-on:change="value = $event.target.value"
x-init="
new Pikaday({ field: $refs.input, 'format': 'MM/DD/YYYY' });"
>
<div class="relative mt-2">
<input
{{ $attributes->whereDoesntStartWith('wire:model') }}
x-ref="input"
x-bind:value="value"
type="text"
class="form-control" placeholder="Select date"
/>
</div>
</div>
/* Component Render */
<x-date-picker
wire:model="start_year"
id="datepicker"
autocomplete="off"
/>
@astondihor
Copy link

Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment