Skip to content

Commit

Permalink
Core: Add deprecation warning to 'date' method
Browse files Browse the repository at this point in the history
Ref #1787
  • Loading branch information
Arkni committed Feb 15, 2018
1 parent fc25612 commit 685ee30
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core.js
Expand Up @@ -1386,6 +1386,16 @@ $.extend( $.validator, {

// https://jqueryvalidation.org/date-method/
date: function( value, element ) {
if ( this.settings.debug && window.console ) {
console.warn(
"The `date` method is deprecated and will be removed in version '2.0.0'.\n" +
"Please don't use it, since it relies on the Date constructor, which\n" +
"behaves very differently across browsers and locales. Use `dateISO`\n" +
"instead or one of the locale specific methods in `localizations/`\n" +
"and `additional-methods.js`."
);
}

return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
},

Expand Down

0 comments on commit 685ee30

Please sign in to comment.