How to change MonthNames or add a new language when using kartik datepicker

Hi everyone,

Is it possible to implement (1) a new language or (2)re-name months when using Datepicker provided by Kartik ?

(1) It seems that most of the locales languages are located in /vendor/bower/jquery-ui/ui/i18n . But does someone know exactly which files is needed and where do they need to be dropped?

(2) I saw there are some options monthNames and short monthNames but it seems we can’t use them when having karmic datepicker.

Thanks for reading and your help.

1 Like

What do you want to achieve?

1 Like

Hi evstevemd,

Thank you for your reply.

I would like to make a datepicker based on the french calendar (republican calendar) which existed from ~1792-1806.
It was a bit particular as :

  • years were reset to year I, II, III… XIV (using Roman counter).
  • months’ names were different that the ones we know now. (Vendémiaire, Brumaire, etc…)
  • days went from 1 to 30 for each months.

I guess changing the counting system for years and days would be hard and maybe there are some workaround for those like starting from year 1 and greyed out all 31st of each month but it doesn’t seem to be very clean…

So for me the easy way would be to change months’ name only.

1 Like

If it is not standard as of today am afraid you are all on your own

1 Like

This problem is more related to the bootstrap datepicker than to Yii2.

But have a look at this StackOverflow answer: https://stackoverflow.com/a/19382272/2530491. This seems to solve your problem.

2 Likes

If you (and your app’s users) are satisfied with changing months’ names only, then @bpanatta’s suggestion looks reasonable to me.

But I would probably want to use a set of 3 dropdown lists (for year, month and day) rather than a single date picker for the input, because you have to deal with a special kind of calendar which is quite different from the current one. I don’t think it’s possible to input the 30th day of the 2nd month using a date picker meant for Gregorian Calendar.

Sorry for the late reply. Corona hitted and I had to put my project on stand-by.

The solution proposed made it !
Thank you to all of you.

1 Like