I have a really annoying issue with JQuery UI Datepicker.
datpicker initialisation
<script>
var dateToday = new Date();
$(function () {
$(".datepicker").datepicker(
{
minDate: dateToday,
dateFormat: "dd/mm/yy",
showOtherMonths: true,
selectOtherMonths: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
gotoCurrent: true
});
});
</script>
deadline field
<div class="form-group">
<div class="col-xs-12">
@Html.EditorFor(model => model.Deadline, new { htmlAttributes = new { @class = "form-control datepicker", placeholder = Html.DisplayNameFor(model => model.Deadline) } })
</div>
</div>
It works fine in that I am unable to select days before today, and I can select future dates and for the most part it works normally.
However, if I select another date from this month, I get a validation error complaining the value must be a date.
How is this even possible, if I haven't specified minimum date requirements anywhere apart from minDate
in the initialiser?