-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Replace or remove date method #1063
Comments
Dear US developers - you are the only country (alongside freakin Belize - combined making up less than 6% of world population) in the world that uses mm/dd/yy. Please stop assuming this is the only format in use for dates with slashes {facepalm} http://en.wikipedia.org/wiki/Date_format_by_country#Map The jQuery Validation > Date demo page still fails for dd/mm/yy dates in Chrome BTW: http://jqueryvalidation.org/date-method - try 13/12/14. We posted a workaround a year ago - see issue #549. |
I've spent some time recently researching HTML5's date and time input types. Over the years, various browsers have added and dropped support. Implementations are often partial, they differ per browser and they can add undesired behaviour. Another pain point is the unreliable browser support for datetime parsing, third-party libraries like Moment.js need to be used. I'll be avoiding these types for the time being, and I wanted to share my findings so you can evaluate the future of related features in this project. |
Is there a way to replace the date method with the dateISO method? Edit: Yes there is, this fixes the localisation issue for me, by using the global standard, without having to change any HTML input types.
|
You can also reuse the default message: $.validator.addMethod("date", $.validator.methods.dateISO, $.validator.messages.date); |
This validates dd/mm/yyyy dates. Reference(Regex): Regex to validate date format dd/mm/yyyy
Usage:
|
Guys is this still an issue? Had a look around and still cant find a decent way to check for dd/mm/yyyy and then also have a custom method to check its over 18 years ago. |
This is how I validated UK dates.
|
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. |
This causes a ton of issues:
Currently the only reasonable way to avoid issues with the native date method messing up validation is to remove the method:
Then using, if necessary, a proper date validation method. An alternative is to ignore date inputs:
ignore: "input[type='date']"
The method as-is needs to be removed, or replaced with something that actually works. Maybe using Globalize, see #581.
The text was updated successfully, but these errors were encountered: