convert date in object code example
Example 1: datetime to date javascript
var currentDate = new Date();
var date = currentDate.getDate();
var month = currentDate.getMonth(); //Be careful! January is 0 not 1
var year = currentDate.getFullYear();
var dateString = date + "-" +(month + 1) + "-" + year;
Example 2: parse date from string in js
Date.parse(dateString)
//dateString is like 2020-10-10 / 2020-10-10T10:20:20