I have this code
[DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}",ApplyFormatInEditMode = true)] [Required(ErrorMessage = "Captura este campo")] public DateTime? BirthDate { get; set; }
<div class="form-group"><label asp-for="BirthDate" class="control-label"></label><input asp-for="BirthDate" asp-format="{0:dd/MM/yyyy}" value="@Model.BirthDate" class="form-control" /><span asp-validation-for="BirthDate" class="text-danger"></span></div>
Im sure model is retrieving value in the right format , but is not showing in the control, so everytime i am updating the object, i must to select date again.