Adding jQuery datepicker to Custom Post Type Metabox [closed]

To properly work I didn’t write my js file like you. My code will only stand for admin side not the frontend.

In the js enqueue js file (date-picker.js):

jQuery(document).ready(function(){
    jQuery('.ads_datepicker').datepicker({ dateFormat: 'yy-mm-dd' });
});

I enqueue my script like this

add_action( 'admin_enqueue_scripts', array($this, 'enqueue_date_picker' ) );

public function enqueue_date_picker(){
    wp_enqueue_script(
        'date-picker-js',
        plugins_url('/js/date_picker.js', __FILE__),
        array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'),
        time(),
        true
    );

    wp_enqueue_style( 'jquery-ui-datepicker' );
    //wp_register_style( 'b-rapid-admin', plugins_url( __FILE__ ) . '/css/date_picker_style.css' );

}

With this js, the id of the input change of course:

public function ads_datetime_start_meta_box(){
    global $post;
    $post_meta = get_post_meta($post->ID);
    ?>
    <input type="date" id="datepicker_start" class="ads_datepicker" name="ads_datetime_start" value="<?php echo $post_meta['ads_datetime_start'][0]; ?>" placeholder=""/>
<?php
}

I think your matter comes from the jQuery(document).ready that is missing.