opened
philanderson888
username_0
At the moment the date is blank in edit mode even though there is a valid date in the database.

Change the view logic to show the date

Should be trivial.
Show the date when editing an item in the FamilyDatabase application
issue
created
philanderson888
username_0
At the moment here is the code in the model

```
        [Display(Name = "Date")]
        [DataType(DataType.Date)]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        public DateTime LogDate { get; set; }
```

I'm not sure if I have to update the model code or the view code.

Let's try updating the model code first
comment
created
philanderson888
username_0
Let's try this fix

```
DataFormatString = "{0:yyyy-MM-dd}"
```
comment
created
philanderson888
username_0
### This was a solution given - does it work?

```
public class ObScore
{
    [DataType(DataType.Date)]
    [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
    public DateTime Date { get; set; }
}
```

and 

```
<div class="form-group">
    @Html.LabelFor(model => model.Date, htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-10">

        @* Control with date picker *@
        @Html.EditorFor(model => model.Date, new { htmlAttributes = new { @class = "form-control" } })
        @Html.ValidationMessageFor(model => model.Date, "", new { @class = "text-danger" })
    </div>
</div>
```
comment
created
philanderson888
username_0
And - yes - wow - just making that very small change has worked!

Problem is now fixed!!!
comment
created
philanderson888
username_0
Should update Notion now also!
comment
closed
philanderson888
username_0
issue