Where trigger the “Please enter a valid date.” in jquery.validate.js

前端 未结 1 842
轮回少年
轮回少年 2021-01-28 21:09

I am using jQuery UI version 1.12.1 and jQuery Validation v1.15.0

I created a datepicker as follow:

if ($.fn.datepicker) $(\':input.date\').datepicker({
         


        
1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-28 21:59

    Found it, it was actually trigger by a date method validation in jquery.validate.min.js, which is in line 1356:

    // http://jqueryvalidation.org/date-method/
            date: function( value, element ) {
                return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
            },
    

    0 讨论(0)
提交回复
热议问题