jquerydatepickerpikaday

Want to Disable two week days instead of Sunday and Saturday


<input id="datepicker">

    var picker = new Pikaday({
    disableDayFn: function(date){
        // Disable Monday
        return date.getDay() === 1;
    },
    field: document.getElementById('datepicker')
});

Currently above code is disabling one day, I want it to disable two days. please help me out to sort it

Example : JsFiddle : http://jsfiddle.net/jpwk4wpv/


Solution

  • Use ||(OR) operation inside disableDayFn as shown :-

    var picker = new Pikaday({
        disableDayFn: function(date){
            // Disable Monday and Tuesday
            return (date.getDay() === 1 || date.getDay() === 2);
        },
        field: document.getElementById('datepicker')
    });
    

    DEMO