DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
JavaScript IsDate Function
JavaScript function that determines if a variable is a proper Date object including a valid date.
function isDate (x)
{
return (null != x) && !isNaN(x) && ("undefined" !== typeof x.getDate);
}






Comments
Charles Beebe replied on Tue, 2012/05/15 - 11:36am
@Snippets Manager: thanks for the help -- this was better than the answers I found on SO!
Jason McDonald replied on Wed, 2007/05/16 - 8:11pm
Snippets Manager replied on Sun, 2009/03/01 - 9:43pm