本场“日期”必须是日期MVC 4 [英] The field 'Date' must be a date MVC 4
问题描述
即时通讯使用jQuery的我,当日期选择器IM面临这样的错误。
Im facing this error when im using my jQuery datepicker.
jQuery的:
$( ".datepicker" ).datepicker({
defaultDate: +7,
autoSize: true,
dateFormat: 'dd.mm.yy',
});
型号:
[DisplayName("Date")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Required(ErrorMessage = "Date is required")]
public DateTime Date { get; set; }
所以,我要的日期格式要像 DD.MM.YYYY
,当我使用日期选择器选择日期是正确添加到外地。而且在同一个第二,一个验证错误出现说字段'日期'必须是日期
。
So I want the date format to be like dd.MM.yyyy
, and when I select the date using the datepicker it is correctly added to the field. But also in the same second, an validation error appears saying The field 'Date' must be a date
.
我做测试用手工编写的日期,格式为 DD / MM / YY
,然后它看起来是工作。所以,在某个地方看起来验证该格式,但我不能找出对其进行修改。
I did test with writing manually the date in the format dd/MM/yy
and then it looks like it is working. So somewhere the validator looks for that format, but I cant find out where to modify it.
推荐答案
您使用Chrome?可一jquery.validate.js问题,请看看这个 jQuery的日期选择器Chrome浏览器
Are you using chrome? Can be a jquery.validate.js issue, please have a look to this Jquery Datepicker Chrome
这篇关于本场“日期”必须是日期MVC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!