Home Forums Backend Issues (wp-admin) Setting minDate on Datepicker


Setting minDate on Datepicker

  • Here’s my setup:


    //* Enqueue Scripts and Styles for ACF
    add_action( 'acf/input/admin_enqueue_scripts', 'my_acf_admin_enqueue_scripts' );
    function my_acf_admin_enqueue_scripts() {    
        // register script
        wp_register_script( 'acf-input-js', get_stylesheet_directory_uri() . '/js/acf-input.js', false, '1.0.0');
        wp_enqueue_script( 'acf-input-js' );


    (function($) {
    	// Minimum Date (2 days ago)
    	$( '.acf-field-58235f2750d77 .acf-date_picker input.input' ).datepicker( "option", "minDate", -2 );

    It won’t set a min date however. I’ve tried other options for that datepicker and the ID is correct. Any idea what I’m doing wrong here?

    Thanks in advance.

  • You might doing it wrong. See here how you can set your custom settings:

    acf.add_filter('date_picker_args', function( args, $field ){
      if($field.attr('data-key') == 'field_58235f2750d77') { // you might want to tweak this field key to match your key
        args.minDate = -2;
      return args;
  • Thank you, @iamntz! That got me pointed in the right direction. Also for some reason enqueuing the script didn’t work. I had to use inline scripts from my functions.php file.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.