Sorry if the question is obvious, but I can’t understand why it suddenly does not work. I have a jquery datepicker that works fine as far as I remember, but all of a sudden, when I try to submit a form that datepicker is on datepicker, it appears as if the date I am submitting is invalid. I already set the date in uk style using the following line of code:
<script type="text/javascript">
$(document).ready(function () {
$('.date').datepicker({ dateFormat: "dd/mm/yy", minDate: 0 });
});
</script>
And I configure the datepicker in my view as follows:
@Html.TextBox("DateDue", "", new { @class = "date" })
I think something requires the selected datestring to be in US format (since it will send a valid date (mm / dd / yyyy), but not in the British format, even if it was set in javascript.
Am I missing something obvious? Can someone tell me what I'm doing wrong here?
, , , datepicker, :
@using (
Html.BeginForm(
Html.BeginForm(
"Create",
"Task",
FormMethod.Post,
new { id = "taskCreateForm" }
)
)
)
PS. Datestring Firefox, Chrome
EDIT:
, js:
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"
type="text/javascript"></script>
, , [Required] [DataType (DataType.Date)] , .
, js, uk, JavaScript , , , - , "" .