JavaScript Future Date Failing
<p>Checking Date these dates fail What do I need to change?</p>

<pre><code>20 Jan 2013
20 jan 2013
20 JAN 2013
2 Jan 2013
30 Jan 2013
20 feb 2013
20 jun 2013
</code></pre>

<p>Code:</p>

<pre><code>function ValidateFutureDate(alertstring,pCheckDate)
{
        // Default Return Variable to return success.
        var returnSuccess = 1;

        // setup a temporary array.
        var temp = new Array();

        // split the date into the array.
        temp = pCheckDate.split(' ');

        // Setup the Test Date 
        var testDate = new Date ( temp[1]+" "+temp[0]+", "+temp[2] );
        var testMonth=testDate.getMonth()+1;
        if  (testMonth&lt;10)
        {
            testMonth = "0"+testDate.getMonth();
        } 
        // This is the Date to test if it is a valid date.        
        var testIsDate = ( testMonth+"/"+temp[0]+"/"+temp[2] );

        // Is this a valid Date
        if(!(isDate(testIsDate))) {
            returnSuccess = 0;
        } else if
        // Check to see if this date is greater then today.
        (!(testDate.getTime() &gt; (new Date().getTime()))) {
            //return Failure zero is a failure.
            returnSuccess = 0;
            alertstring = alertstring + 'Expiration must be in the future. \n';
        }



    // Return the Success or Failure of the Date Format Validation
    return returnSuccess;

} 
</code></pre>
