The field must be a date - DatePicker validation fails in Chrome - mvc

后端 未结 6 1649
再見小時候
再見小時候 2020-12-03 04:48

I have strange problem. My date validation doesn\'t work in Chrome. I\'ve tried this answer but it didn\'t work for me.

I have this in my model:

[Dis         


        
6条回答
  •  庸人自扰
    2020-12-03 05:30

    It is kind of late to crash to the party after a year, but I've tried every solution I could find regarding this error, and none of them helped. So for anyone struggling like myself here is what solved this issue.

    Add to the end of jquery.validate.globalize.js and its minified version(depends on what you are using) this little snippet of code.

    ... 
       $.validator.methods.range = function (value, element, param) {
            var val = Globalize.parseFloat(value);
            return originalMethods.range.call(this, val, element, param);
        };
    
    
    }(jQuery, Globalize));
    

    Globalize.culture("en-GB");

    Of course, use your own culture settings inside quotation marks.

    Hope it helps!

提交回复
热议问题