Redadublex
Redadublex

Reputation: 129

Bootstrap datePicker change location

I'have a working bootstrap datePicker but in english, i need to change it to french, i've added a file (bootstrap-datepicker.fr.js) with this content

(function($){
$.fn.datepicker.dates['fr'] = {
    days: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"],
    daysShort: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
    daysMin: ["d", "l", "ma", "me", "j", "v", "s"],
    months: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"],
    monthsShort: ["janv.", "févr.", "mars", "avril", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."],
    today: "Aujourd'hui",
    clear: "Effacer",
    weekStart: 1,
    format: "dd/mm/yyyy"
}; } (jQuery));

and i'have this piece of code in my view page, to format and change location

<script type="text/javascript">
$(function () {
    $('.dp').datepicker({
        format: 'dd/mm/yyyy',
        language :'fr'
    });
});

After including bootstrap-datepicker.fr.js, i got this error

TypeError: $.fn.datepicker is undefined  $.fn.datepicker.dates['fr'] = {....

Upvotes: 0

Views: 424

Answers (1)

Nitesh Patil
Nitesh Patil

Reputation: 388

I think you have included bootstrap-datepicker.fr.js before bootstrap-datepicker.js... Include it after bootstrap-datepicker.js

Please share HTML file if problem is not solved

Upvotes: 1

Related Questions