I have the following scenario
public class Foo {
public Bar FooBar { get; set; }
}
public class Bar {
[DisplayFormatAttribute(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
public DateTime BirthDay { get; set; }
}
Now when I use EditorFor I want to apply the DataFormatString on my DateTime
@Html.EditorFor(x => x.FooBar.BirthDay);
The above code does not render the date correct using the DisplayFormatAttribute, so how can I solve this?