8

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?

1
  • @neoascetic, thanks, made typo when pasting here. Still not sure how to solve.
    – mishap
    Apr 21, 2012 at 1:59

1 Answer 1

13

$.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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.