I am developing an ASP.NET MVC4 application.
My View Model Class Property
[DisplayName("Birth Date")]
[Required(ErrorMessage = "You must indicate your full birthday")]
[DataType(DataType.Date), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime BirthDate { get; set; }
Javascript Code
var dt = new Date();
$(function () {
$("#BirthDate").datepicker({
showOn: "button",
buttonImage: "@Url.Content("~/Content/themes/base/images/calendar.gif")",
buttonImageOnly: true,
dateFormat: 'dd/mm/yy',
changeMonth: true,
changeYear: true,
yearRange: '1980:dt'
});
});
View code
<div class="block">
@Html.LabelFor(model => model.BirthDate, new { @Class = "compel" })
@Html.TextBoxFor(model => model.BirthDate)
</div>
When I run the application in IE and Mozilla Firefox it works fine, but with google chrome, it gives validation error as The Value 24/12/2012 is invalid for Birth Date.
Kindly help me to resolve this issue.