Home › Forums › ACF PRO › Adding custom javascript to date and time picker fields › Reply To: Adding custom javascript to date and time picker fields
Ok..solved it..
Perhaps, you should add an example, it was realy confusing for me.
This is the solution:
/*
@ Format Date time picker fields
*/
function my_acf_input_admin_footer() {
?>
<script type="text/javascript">
(function($) {
// JS here
acf.add_filter('date_picker_args', function( args, $field ){
// do something to args
args['minDate'] = "-30"; //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', 'my_acf_input_admin_footer');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.