I have the following datepicker that works so far fine:
$('.tmmdatepicker').datepicker({ showOn: "button",
buttonImage: "../Content/images/ico-calendar.png",
buttonImageOnly: true,
dateFormat: "d M, yy",
showAnim: "fadeIn",
autosize:true
});
Here is the razor view:
<tr>
<td>Start date:</td>
<td> @Html.EditorFor(m => m.CurrentFilter.StartTime,
new { @class = "tmmdatepicker" , @style = "width:80px" })
</td>
It works so far well, but the first time the view is loaded, the time will not be formatted in the given format (d M, yy), only after i use once the datetimepicker then the content of the EditorFor will be updated with the rule.
So, when i first enter the site:

and after i use the button to select a date:
<— this is how i want to see it at the beginning.
So, is there a way to load this behavior at the beginning? (sorry, i cannot inclide direct links to pictures)
You can use EditorTemplates.
Create file
~/Views/Shared/EditorTemplates/DateTime.cshtmlwith following codes: