I upgraded an MVC3 solution to MVC4. After the migration, the validator is broken.
My input date, if i select German as language, is \"20.03.2013\". I get an validation
Try overwriting the default date validator:
// Replace dots so jq validator can understand what's going on
$(function () {
$.validator.addMethod(
"date",
function (value, element) {
var s = value;
s = value.replace(/\./g, '/');
// Chrome requires tolocaledatestring conversion, otherwise just use the slashed format
var d = new Date();
return this.optional(element) || !/Invalid|NaN/.test(new Date(d.toLocaleDateString(value))) || !/Invalid|NaN/.test(new Date(s));
},
""
);
});
$.validator.unobtrusive.parse();