kashifaltaf / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

Validation of Invalid Date passes #152

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Enter 00/00/0000

should be treated as invalid Date, by after parsingExact, the date variable has 
Min Date in it.

Also would be nice to provide IsDateValid(should take care about format) method 
or anything related to that. Also would be nice to Provide Min and Max Value 
range for the Date variable.

function like IsValid should take car about format;
25/10/2001 is valid on for format "dd/MM/yyyy" and invalida for "MM/dd/yyyy" 
format.

Here is the code that i have been using.

$("input[id *= txtEffectiveDate]").focusout(function () {
        var enteredDate = $("input[id *= txtEffectiveDate]").val();
        var dt = Date.parseExact(enteredDate, "MM/dd/yyyy");
        $("#DivEffectiveDateErr").empty();
         if (dt)
              $("#DivEffectiveDateErr").hide();
        else {
             $("#DivEffectiveDateErr").append("The Date entered ( " + 
               enteredDate + ") is not a valid date – The Date format 
               accepted by the application is MM/DD/YYYY”. ");
             $("#DivEffectiveDateErr").show();
             }
 });

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by naunihal...@gmail.com on 2 May 2012 at 4:02