Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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"
});


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

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 <anonymous>:6:16
at r (notifications?locale=tr:13:73)
at <anonymous>: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/ ?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(