I have some problems with client-side validation DateTime fields. I'm using following DataAnnotation in my model class to DateTime fields:
[Display(Name = "Beginning Date", Description = @"Insert Date yyyy-mm-dd")]
[DataType(DataType.Date, ErrorMessage = @"Insert Date yyyy-mm-dd")]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
I'm using Datapicker from jQuery UI to insert date. Date format is enforced by
$(document).ready(function () {
$.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });
});
So it works great on Firefox but completely crash on Internet Explorer when I insert date using Datepicker. When I type date in format yyyy/mm/dd instead of yyyy-mm-dd then is no validation error.
Does anyone know why the validation format is different on Internet Explorer than Firefox and where I can change it?
Thanks for help.