captbaritone / captbaritone/datejs

Validation of Invalid Date passes

Open
#152 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.