Home › Forums › Front-end Issues › Datepicker doesn't update field value on month / year change. › Reply To: Datepicker doesn't update field value on month / year change.
Okay, I found some pointer from zilveer, here:
https://support.advancedcustomfields.com/forums/topic/adding-custom-javascript-to-date-and-time-picker-fields/
and also here:
https://www.advancedcustomfields.com/resources/acf-input-admin_footer/
With this result, that seems to be working!
<?
function my_acf_input_admin_footer() {
?>
<script type="text/javascript">
(function($) {
acf.add_filter('date_picker_args', function( args ){
args['onChangeMonthYear'] = function(y, m, i){
var d = i.selectedDay;
$(this).datepicker('setDate', new Date(y, m-1, d));
}
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.