registry()->get( 'i18n' )->get_js_datepicker_format( 'MM d, yy' ); $charitable_json_args = array( 'changeMonth' => true, 'changeYear' => true, 'dateFormat' => $charitable_date_format, 'yearRange' => $charitable_year_range, 'monthNames' => array_values( $wp_locale->month ), 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), ); if ( array_key_exists( 'min_date', $charitable_field ) ) { $charitable_json_args['minDate'] = '+' . $charitable_field['min_date']; } if ( array_key_exists( 'max_date', $charitable_field ) ) { $charitable_json_args['maxDate'] = '+' . $charitable_field['max_date']; } /* Enqueue the datepicker */ if ( ! wp_script_is( 'jquery-ui-datepicker' ) ) { wp_enqueue_script( 'jquery-ui-datepicker' ); } $charitable_datepicker_json_args = wp_json_encode( $charitable_json_args ); wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready( function(){ jQuery( '.datepicker' ).datepicker( {$charitable_datepicker_json_args} ); });" ); wp_enqueue_style( 'charitable-datepicker' ); ?>