Support

Account

Home Forums ACF PRO Disable dates or days of the week in date picker

Unread

Disable dates or days of the week in date picker

  • The following codes works like a charm setting NO PAST DATES and ONLY 30 DAYS in the future. So here you go:

    function yl_date_picker_customizations() {
    	?>
    	<script type="text/javascript">
    		(function($) {
    
    			// JS here
    
    			acf.add_filter('date_picker_args', function( args, $field ){
    
    				// do something to args
    				args['minDate'] = '0';	//For example, "+1m +7d" represents one month and seven days from today.
    				args['maxDate'] = '30';
    
    				return args;
    
    			});
    
    			acf.add_filter('time_picker_args', function( args, $field ){
    
    			// do something to args
    
    				args['stepMinute'] = 5;
    
    			// return
    			return args;
    
    		});
    
    		})(jQuery);	
    	</script>
    	<?php		
    }
    
    add_action('acf/input/admin_footer', 'yl_date_picker_customizations');

    But does anyone know how to add DISABLED DATES and DISABLED DAYS OF THE WEEK?

    Why do I need this? I want customers to be unable to select Sundays and unable to select specific future dates…

    Hope there will be an option for this. Thank!

Viewing 1 post (of 1 total)

The topic ‘Disable dates or days of the week in date picker’ is closed to new replies.