How to change the language of browser native datePicker?

Viewed 5566

Hello I was playing around with HTML5 datePicker and I was wondering how I could change the default language of the widget. How to change the lang from english to german? Any idea?

<form action="/action_page.php">
  Birthday:
  <input type="date" name="bday">
  <input type="submit">
</form>

Thanks

3 Answers

This works on safari but not in Chrome or Firefox:

<form action="/action_page.php">
  Geburtstag:
  <input type="date" name="bday" placeholder="tt/mm/jj">
  <input type="submit" value="einreichen">
</form>

However you can use polyfills to make it work on all browsers. Look at this example of a module to understand it better.

the most common way to force to change the language is the next :

<form lang="es">
        <input type="text" pattern="\d{1,15}" required />
        <input type="submit" />
    </form>

if you want more information about declare language, can you learn more in the next links :

http://nimbupani.com/declaring-languages-in-html-5.html

I hope my answer is helpful.

type date for html is browser native control, at least for chrome this stands true. So it will be localised according to the language of the browser. However frameworks like bootstrap has better locale support or even you can set locale settings in jquery manually with some scripting at server side.

Related