Skip to content

Instantly share code, notes, and snippets.

@benvds
Created July 4, 2012 12:12
Show Gist options
  • Save benvds/3047013 to your computer and use it in GitHub Desktop.
Save benvds/3047013 to your computer and use it in GitHub Desktop.
Configure Bootstrap DatePicker for Dutch
(function() {
/* Update date_input plugin so that DD-MM-YYYY format is used. */
$.extend($.fn.datepicker.defaults, {
parse: function (string) {
var matches;
if ((matches = string.match(/^(\d{2,2})\-(\d{2,2})\-(\d{4,4})$/))) {
return new Date(matches[3], matches[2] - 1, matches[1]);
} else {
return null;
}
},
format: function (date) {
var
month = (date.getMonth() + 1).toString(),
dom = date.getDate().toString();
if (month.length === 1) {
month = "0" + month;
}
if (dom.length === 1) {
dom = "0" + dom;
}
return dom + "-" + month + "-" + date.getFullYear();
},
monthNames: ['Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni',
'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December'
],
shortDayNames: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za']
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment