Datepicker language
https://imgur.com/a/08UaLLJ
https://devs.keenthemes.com/question/datepicker-language-setting
Hello, I tried to make the date field tr according to the answer in this question, but it doesn't work. After adding the .js link, I compiled it with gulp and defined it in the code as follows.
$('[data-kt-repeater="datepicker"]').flatpickr({
dateFormat: "d-m-Y",
"local": "tr"
});
Replies (3)
Hi,
It should work as expected if all steps are followed.
Have you included the TR language file in the gulp config in the right order?
Regards.
yes the order is correct. I compiled it by saying gulp. But it gives this error. I wonder if I need to import the file as below
?
import language from 'flatpickr/dist/l10n/tr'
plugins.bundle.source.js:19907 Error: flatpickr: invalid locale tr
at setupLocale (plugins.bundle.source.js:21888:1)
at init (plugins.bundle.source.js:20468:1)
at FlatpickrInstance (plugins.bundle.source.js:22465:1)
at _flatpickr (plugins.bundle.source.js:22484:1)
at jQuery.fn.flatpickr (plugins.bundle.source.js:22535:1)
at :6:16
at r (notifications?locale=tr:13:73)
at :1:1
If you included "{$config.path.node_modules}/flatpickr/dist/l10n/tr.js"
in tools/gulp.config.js
and recompiled it with gulp then it should work as expected. No need to import it, just set your language in the JS initialization and that should be it:
$("#kt_datepicker_1").flatpickr({
"locale": "tr"
});
If you need any further help could you please provide us with your gulp config source and JS datepickr init code using https://gist.github.com/ ?