- Library Version: 0.3.4
- Laravel Version: 9.4.1
- PHP Version: 8.1.3
Description:
PR #125 (and therefore version 0.3.4) breaks the defaultDate Flatpickr property before mouseenter is triggered. Since the instance is not initialized before mouseenter is triggered, the default date is not set on page load.
A workaround for this is to set the value attribute instead of defaultDate, but this does not work when wanting to use altInput since value on the instance and value on the input field (the display) differs. It therefore results in the true, non-alt value showing until mouseenter is triggered, upon which the formatting from altFormat is applied.
For anyone else encountering this before it is fixed: Set blade-ui-kit/blade-ui-kit to 0.3.3 in composer.json and run composer update and php artisan view:clear.
Steps To Reproduce:
This is my scenario which I haven't found a workaround for.
<x-buk-flat-pickr
name="flatpickrInstance"
format="Y-m-d H:i:S"
value="12:00" # This provides the default value before the instance is initialized. Can be removed to make the issue more obvious
:options="['defaultDate' => '2022-04-29 12:00', 'altInput' => true, 'altFormat' => 'H:i']"
/>
<script>
// This returns "12:00" before mouseenter and "2022-04-29 12:00" after mouseenter
// It should always return the full date string
console.log(flatpickrInstance.value);
</script>