Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date/dateISO do not check days of month correctly #1861

Closed
jmp909 opened this issue Sep 17, 2016 · 2 comments
Closed

date/dateISO do not check days of month correctly #1861

jmp909 opened this issue Sep 17, 2016 · 2 comments
Labels
stale Used to mark stale issues

Comments

@jmp909
Copy link

jmp909 commented Sep 17, 2016

as of here: https://jqueryvalidation.org/dateISO-method/

both of these dates don't validate correctly, they should fail

2011-11-31
2011-02-29

normally i would use this which checks the data parsed from the input string matches the supplied date

var d = new Date(Date.parse(str))
return str === (d.getFullYear() + '-' + (d.getMonth()+1) + '-' + d.getDate());

since 2011-02-29 would parse as 2011-03-01, then this would fail properly

please advise

thanks
J

@Arkni
Copy link
Member

Arkni commented Sep 17, 2016

The date method should not be used since it relays on the Date constructor which behaves differently across browsers. It's stated clearly in the docs of this method.

As for the dateISO method, there is a PR that adds sanity checks (#1528) to the method but not merged yet, as it could be considered a BC break for those who still rely on the old behavior (even though it's wrong).

@stale
Copy link

stale bot commented Jun 5, 2018

This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up.
Thank you for contributing :)

@stale stale bot added the stale Used to mark stale issues label Jun 5, 2018
@stale stale bot closed this as completed Jun 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Used to mark stale issues
Projects
None yet
Development

No branches or pull requests

2 participants