Skip to content

Instantly share code, notes, and snippets.

@victorzen
Last active April 16, 2016 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorzen/e41619fb44347247240d to your computer and use it in GitHub Desktop.
Save victorzen/e41619fb44347247240d to your computer and use it in GitHub Desktop.
Translate Datepicker to any language.

Change "YourFieldName" for the field name in your form and change the information to your own language and prefered date format. This example is in French :) Set placement to "Head"

<script>
$(function() {
$( "#YourFieldName").datepicker({
    altField: "#datepicker",
    closeText: 'Fermer',
    prevText: 'Précédent',
    nextText: 'Suivant',
    currentText: 'Aujourd\'hui',
    monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
    monthNamesShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'],
    dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
    dayNamesShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'],
    dayNamesMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
    weekHeader: 'Sem.',
    dateFormat: 'yy-mm-dd'
    });
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment