Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #check #date #object
ADD COMMENT
Topic
Name
1+1 =