Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change input type=date calender language/Localization?

I want to change my calendar dates language English to french.

<input type="date" name="licence_date" id="licence_date" class="form-control">

enter image description here

I want to change this calendar language English to french

like image 981
vicky793 Avatar asked Apr 13 '20 11:04

vicky793


1 Answers

You can assign a language to the input date type by changing the language of the page or the item itself, as documented on MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#Localization

<label for="licence_date">Licence Date</label>
<input type="date" name="licence_date" id="licence_date" lang="fr-CA">

However, that will not change the display language of the calendar shown, because that calendar element is a browser UI element, and the overwhelming majority of browsers only natively display one language at a time. Even Firefox, which supports multiple language packs, only uses the primary one chosen at any one time, and it's that UI language which it will show the input date picker with.

The good news is that your users will already see the date picker in their browser's language, no matter how obscure the language.

like image 77
frandroid Avatar answered Oct 17 '22 12:10

frandroid