flowbite
flowbite copied to clipboard
datepicker listens to 'changeDate' instead of 'change'
Describe the bug When using svelte with flowbite datepicker, I am trying to bind the value from the user input to the component. But the problem is that the datepicker.js handles onChangeDate instead of a standard DOM onChange. So typescript gives me error when implementing the function.
The ts error is:
Argument of type '{ name: string; type: "text"; class: string; placeholder: string; "on:changeDate": (e: any) => void; value: string; }' is not assignable to parameter of type 'HTMLProps<"input", HTMLAttributes<any>>'.
Object literal may only specify known properties, and '"on:changeDate"' does not exist in type 'HTMLProps<"input", HTMLAttributes<any>>'.ts(2345)
To Reproduce Steps to reproduce the behavior:
- Init a svelte project
- import datepicker.js
- use the input flowbite datepicker
- try to handle user input using "on:changeDate={(e) => inputDate = e.target.value}"
Expected behavior The expected behaviour is that datepicker.js listens to "change" instead of "changeDate"
Additional context I might be wrong but flowbite-svelte should be having the same problem.
@fabiot21 Have you found a work around?
nope, i ended up creating my own datepicker
Hey everyone,
We have made a big update to the datepicker API that allows you to change and set dates, amongst other things:
https://flowbite.com/docs/components/datepicker/#javascript-behaviour
Cheers, Zoltan