Closed
Description
https://jqueryvalidation.org/date-method/ says: This method is deprecated and will be removed in version 2.0.0
.
Please don't use it, since it relies on the Date
constructor, which behaves very differently across browsers and locales. Use dateISO
instead or one of the locale specific methods (in localizations/ and additional-methods.js).
So we're using localization/methods_pt.js
, and observing that it causes validation of date inputs to always fail, because they are unconditionally validated using the deprecated method, and not its suggested replacements.
Environment
jquery@3.5.1
jquery-validation@1.19.2
jquery-validation-unobtrusive@3.2.11
- Chrome 86.0.4240.111
Steps to reproduce
- https://jsfiddle.net/1ua63jx0/
- focus into and out of the date input: it gets a red border, indicating
class="input-validation-error"
- if
localization/methods_pt.js
is not loaded, then the validation succeeds -- even though our actual date format conforms tomethods_pt
This is because date input value is always in ISO format, regardless of the display format (reference)
Expected behaviour
normalizeAttributeRule
should matchdate
input type withdateISO
rule, instead ofdate
rule.