Reputation: 39
I have a strange issue with my project:
While using the same MSSQL Database, my local version shows date like this:
And my web version shows like this:
Moreover, when I'm trying to edit, in my local version the "datepicker" is populated by my model.date, and on the web version.. not.
@Html.EditorFor(model => model.StartDate, new { htmlAttributes = new { @class = "form-control" } })\
Here's part of viewmodel:
[DataType(DataType.Date)]
[DisplayName("Data od")]
public DateTime? StartDate { get; set; }
I assume its because of that different Date format. How can I approach this issue?
Upvotes: 0
Views: 22
Reputation: 126
Add new Data Annotation to StartDate property
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]
Upvotes: 1