js new Date year and month code example
Example 1: how make date object in jquery from custom date
var formattedDate = new Date("yourUnformattedOriginalDate");
var d = formattedDate.getDate();
var m = formattedDate.getMonth();
m += 1; // JavaScript months are 0-11
var y = formattedDate.getFullYear();
$("#txtDate").val(d + "." + m + "." + y);
Example 2: new date javascript
/*Get date from JS API - Date() class*/
let local_date = new Date();
alert("it is " + local_date + "!")