Support

Account

Home Forums Feature Requests Block days datepicker

Solving

Block days datepicker

  • Hi,

    I’m trying to get able to block some days to datepicker from an admin interface with a calendar, choosing a day and with a checkbox or something like that and block the day.
    There’s some way to do that?
    Or any advice where to start?

    Thanks and regards,

  • The following jQuery snippet will block all days except Friday (I’m using it for a week-ending form).

    You could try returning the day of the week (in this case 5) or the date as a PHP variable from an ACF custom field.

    https://stackoverflow.com/questions/19395558/highlight-disable-specific-days-in-jquery-ui-datepicker shows examples of formatting for specific dates.

    jQuery(document).ready(function() {
    	$datepicker = jQuery('.rdsn-week-ending .hasDatepicker');
    	$datepicker.datepicker( 'option', {
    		beforeShowDay: function(date) {
            	if (date.getDay() == 5) {
                        return [true, ''];
                    } else {
                        return [false, ''];
                    }
        	}
    	});
    });
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Block days datepicker’ is closed to new replies.