I want to have my localized datepicker not allow certain dates picking.
Localization:
$("#datepicker").datepicker($.datepicker.regional["fr"]);
No weekends :
$("#datepicker").datepicker({ beforeShowDay: $.datepicker.noWeekends })
I cannot figure out how to combine both?
$.datepicker.regional
attribute attribute holds an array of localizations; which themselves are "presets" of the datepicker options. To append your options (overwriting if necessary):
// use $.extend to merge preset options plus your options
$("#datepicker1")
.datepicker($.extend({}, $.datepicker.regional.fr, {
beforeShowDay: $.datepicker.noWeekends
}));
// initialize the datepicker, then use .datepicker("option", options) method twice
$("#datepicker2")
.datepicker()
.datepicker("option", $.datepicker.regional.fr)
.datepicker("option", "beforeShowDay", $.datepicker.noWeekends);
Demo (see example 5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With