How can i set the date format for an asp-validation-for?
The input is dd/mm/yy and i have set a min and max date but the validation message displays as yyyy-mm-dd.
Model
public class ValidateNullDate
{
[Required]
[DataType(DataType.Date, ErrorMessage = "Date is required")]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
public DateTime? Date { get; set; }
}
<form asp-controller="Date" asp-action="ValidateNullDate" method="post">
<input type="date" asp-for="Date" min="2019-01-01" max="2020-12-31" />
<span asp-validation-for="Date" class="text-danger" ></span>
<button class="btn btn-primary btn-block text-white btn-user" type="submit">Submit</button>
</form>
I am not using a plugin to handle the date picker. I am using jquery validation etc.