how to check if its a date in js code example
Example: javascript check if date object
let date1 = new Date();
let date2 = new Date("random string");
(Object.prototype.toString.call(date1) === '[object Date]' && date1 != "Invalid Date") // true
(Object.prototype.toString.call(date2) === '[object Date]' && date2 != "Invalid Date") // false