Get current day using javascript [closed]

I’ve an approach for you, getting the WordPress date in JavaScript, a numb one, but still an approach: 🙂

functions.php

wp_enqueue_script( 'wpse-custom-scripts', get_template_directory_uri() .'/js/wpse-custom.js', array('jquery'), '1.0.0', true );

wp_localize_script(
    'wpse-custom-scripts',
    'wpse',
    array(
        'date_time_now' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), //format: YYYY-MM-DD 00:00:00
    )
);

wpse-custom.js

jQuery(document).ready(function($) {
    console.log("WordPress date now: " + wpse.date_time_now);
});

It’s not a better approach, I know.