我正在使用这个 jQuery 插件来选择时间:http: //jonthornton.github.io/jquery-timepicker/
我像这样初始化我的时间选择器:
$('#scheduletime').timepicker({ 'scrollDefaultNow': true, 'timeFormat': 'h:i A' });
这导致时间以下列格式显示:
08:00 AM
我正在使用 MVC 客户端验证,我的模型如下所示:
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:hh:mm tt}")]
public DateTime? ScheduleTime { get; set; }
我的问题是我收到客户端验证错误:
字段 ScheduleTime 必须是日期。
怎么了?字符串验证格式似乎是正确的,但它不起作用。