[thelist] [JS] isDate function
Scott Brady
dsbrady at gmail.com
Tue Mar 8 15:04:37 CST 2005
On Tue, 8 Mar 2005 12:49:49 -0500, Joshua Olson wrote:
> After searching the web for isDate functions I found myself unhappy with
> most of them. Too long, too tedious, etc. So, I made my own to parse
> normal US formatted dates (MM/DD/YYYY). Can anybody spot a reason why the
> following code wouldn't work?
I don't see why that wouldn't work, but is there a reason you can't
just do this:
function isDate(str)
{
var myDate = new Date(str);
return !isNaN(myDate);
}
(I'm not sure about older browsers on that, but it should work for
21st Century browsers, at least)
Scott
--
-----------------------------------------
Scott Brady
http://www.scottbrady.net/
More information about the thelist
mailing list