Guest_imported
New member
- Jan 1, 1970
- 0
Hello i was using the following code to check for bad dates. However it evaluates 32/32/32 and 1/1/1 to be valid dates. Can the date object once loaded tell me if its a correct date. Or is the only way to check the date is to break it up into mm dd yyyy and check each portion for validity.
function goodDate()
{
var fromDate = FrontPage_Form1.DatePeriodfrom.value;
var toDate = FrontPage_Form1.DatePeriodTo.value;
testFrom = new Date(fromDate);
testTo = new Date(toDate);
if (fromDate != "" && toDate != ""
{
if (testFrom == "NaN" || testTo == "NaN"
{
alert("bad date"
;
}
}
}
howard
function goodDate()
{
var fromDate = FrontPage_Form1.DatePeriodfrom.value;
var toDate = FrontPage_Form1.DatePeriodTo.value;
testFrom = new Date(fromDate);
testTo = new Date(toDate);
if (fromDate != "" && toDate != ""
{
if (testFrom == "NaN" || testTo == "NaN"
{
alert("bad date"
}
}
}
howard