SyntaxFix
Write A Post
Hire A Developer
Questions
Try this:
var date = new Date(); console.log(date instanceof Date && !isNaN(date.valueOf()));
This should return true.
true
UPDATED: Added isNaN check to handle the case commented by Julian H. Lam
isNaN