DatePicker personalized months #1921
-
Hello everyone! I am trying to use the DatePicker component with the translated month labels. It happens that, when I pass the months as an array, I get the following error: Unhandled Runtime Error Source 11 | const init = async () => {
However, I am passing the array as follows Below is the complete component: Can anyone help me please? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
For options that require arrays/objects it's best to use the JS initialization. Try initializing the component via JS. Checkout the example in our docs https://tailwind-elements.com/docs/standard/forms/datepicker/#section-translations |
Beta Was this translation helpful? Give feedback.
-
The problem when I initialize it with JS is that, when selecting a date, the datePicker gets stuck, it does not close. I don't know what the reason is. Maybe I'm implementing it wrong. Below I show you how I initialize it:
|
Beta Was this translation helpful? Give feedback.
-
You are a genious! Thank you so much! That was the problem. I just removed the data-to-datepicker-init attribute and it worked |
Beta Was this translation helpful? Give feedback.
Try removing either the
Datepicker
from theinitTE
method or removing thedata-te-datepicker-init
attribute from the input wrapper. I think that the component may be initialized twice (once with theinitTE
method and once with use of js -new Datepicker(...)
) and that causes those issues