Support

Account

Home Forums Front-end Issues disableTimeRange ACF Timepicker not working?

Solving

disableTimeRange ACF Timepicker not working?

  • I have a Timepicker with some custom javascript added like this:

    acf.add_filter('time_picker_args', function( args, $field ){
    
        // do something to args
    
        args['minTime']			= '12:00:00'; // Set start time
        args['maxTime']			= '20:30:00'; // Set end time
        args['minDate']			= '+1'; // Remove NOW button
        args['stepMinute']			= 15; // Minute interval of 15 minutes
        args['showSecond']			= false; // Remove seconds field
        args['disableTimeRanges']	= [ ['15:00:00', '17:00:00'], ['19:00:00', '20:00:00'] ]; // Disable time ranges
    
        // return
        return args;
    
    });

    All works except disabling time ranges. Everywhere online I get the same ‘disableTimeRanges’ to accomplish this but it just doesn’t work no mather what I try.

    Anybody know how to get (1 or more) Time ranges disabled in the Timepicker?

  • What is the arg key for mintime and maxtime? Have you found the answeršŸ¤£, I notice you asked same question two years ago.

  • I just found the correct answer
    <script type=”text/javascript”>
    (function($) {
    acf.add_filter(‘time_picker_args’, function( args, $field ){
    args.hourMin= 7;
    args.hourMax= 22;
    args.stepMinute = 15;
    args[‘showSecond’] = false;
    return args;
    });

    })(jQuery);

    </script>

    on this site all the args name for timepicker are listed
    https://trentrichardson.com/examples/timepicker/

  • People still use Jquery?

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

The topic ‘disableTimeRange ACF Timepicker not working?’ is closed to new replies.