Support

Account

Home Forums Feature Requests Block days datepicker

Helping

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,

    • redsun

    • March 22, 2020 at 3:35 am

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.