I need to capture date and time both for my model property. In my model class I have the following
[Required]
[DataType(DataType.DateTime)]
public DateTime? CallBackDate { get; set; }
When I enter a valid date time (e.g. 28/05/2015 15:55
) I keep getting this error The field CallBackDate must be a date.
I have seen similar question and tried various answers but nothing seems to get rid of this. I m using unobtrusive client side validation and I can't disable it.
The source of the input field has the following markup
<input autocomplete="off" class="jquery_datetimepicker form-control hasDatepicker" data-val="true" data-val-date="The field CallBackDate must be a date." data-val-required="The CallBackDate field is required." id="CallBackDate" name="CallBackDate" placeholder="Enter your CallBackDate" type="text" value="">
And jquery datetime picker has the following markup
$('.jquery_datetimepicker').datetimepicker({
dateFormat: 'dd/mm/yy',
minDate: 0,
showWeeks: true,
showStatus: true,
highlightWeek: true,
numberOfMonths: 1,
showAnim: "scale",
showOptions: {
origin: ["top", "left"]
},
timeFormat: 'hh:mm tt'
});
Any ideas? thanks