Dudes, been trying for very long time on solving this. I have been looking around and been fiddling around but i just cant get it to work!!
For my DOB, im hoping to accept date in dd/mm/yyyy.. however it only accepts mm/dd/yyyy. Where should i make the fix?
I got inspirations from Jquery Datepicker 1 and Jquery Datepicker 2.
In my Model
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Date of Birth")]
public DateTime DOB { get; set; }
In my View, pretty straight forward
@Html.EditorFor(model => model.DOB)
Have an Editor Template that is called up whenever date is used.
@model DateTime?
@Html.TextBox("", Model != null ? Model.Value.ToString("dd/mm/yyyy") : "", new { @class = "date" })
Wrote another editorhookup, that refs Jquery
$(document).ready(function () {
$('.date').datepicker({ dateFormat: "dd/mm/yy" });
});
Any help is appreciated!