I have a DateTime field with its BootstrapDatePicker like the following:
<div class='input-group date' id='datetimepicker1'>
@Html.TextBoxFor(m => m.DatePicker, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.DatePicker)
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
And its respective Javascript:
$(document).ready(function () {
//DatePicker
$('#datetimepicker1').datetimepicker({
defaultDate: new Date(),
format: 'MM/DD/YYYY',
minDate: new Date(),
locale: 'es'
});
Model:
[DataType(DataType.Date), DisplayFormat(DataFormatString = "{0:dd.MM.yy}", ApplyFormatInEditMode = true)]
[Required(ErrorMessage = "Formato incorrecto")]
public DateTime? DatePicker { get; set; }
The problem is sending the date. I accept values from 03/1/2018
to 03/12/2018
works correctly, but if I send 03/13/2018
the page only returns a BadRequest. The format of my date is in English format. I do not understand why it is failing to send you the value of 13 onwards. I hope you can help me. Thanks