DatePicker language

I would like to change the language of the DatePicker component.

Is there a way to change month and weekday words in the component?
Or do I have to create a custom Date picking component to be able to change text?

Any help would be appreciated.

Hi @augustas.volbekas and welcome to the forum,

this post should help:

To find the script for your preferred language you can get the url from jsdeliver

moment CDN by jsDelivr - A CDN for npm and GitHub

3 Likes

Thanks a lot @stucork , that really helped.

There is another small thing - datePicker has “Apply” and “Cancel” buttons when picking time which is in English, is it possible to change, the text of these buttons?

Sure. There may be a better solution. But one way would be to use our anvil.js library

from anvil.js.window import document

  def __init__(self, **properties):
    ...   
    for btn in document.querySelectorAll('.daterangepicker .applyBtn'):
        btn.textContent = 'foo'
    for btn in document.querySelectorAll('.daterangepicker .cancelBtn'):
        btn.textContent = 'bar'


3 Likes

Thank you very much, works perfectly :grinning_face_with_smiling_eyes:

1 Like