I am passing the following function a string value '13-05-2004'. It is supposed to parse out the individual numeric values and see if they are valid month, day, and year values.
The alert shows 13-04-2004
The alert shows 13 04 2004
The alert shows 13
The alert doesn't show and no value is returned
What am I doing wrong? Thanks for the help.
Have a nice weekend,
Michael Brennan-White
New Hampshire Treasury Department
Code:
function ParseDate(FormField,DateFormat)
{
//DateFormat 1 = mmddyyyy, 2 = yyyymmdd
var cFieldValue =
document.getElementById(FormField).value;
//alert(cFieldValue);
Code:
var dtDate_array= cFieldValue.split("-");
alert(dtDate_array[0]+" "+dtDate_array[1]+" "+dtDate_array[2]);
Code:
if(DateFormat = 1)
//mm-dd-yy format
{
alert(parseInt(dtDate_array[0]));
Code:
if (parseInt(dtDate_array[0]) < 0 && parseInt(dtDate_array[0]) > 12)
{alert('Bad Month Passed');
return false;
}
What am I doing wrong? Thanks for the help.
Have a nice weekend,
Michael Brennan-White
New Hampshire Treasury Department