Reputation: 452
So I'm dealing with an issue I have a standard core app. With the model which has following:
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime StartOfSit { get; set; }
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime EndOfSit { get; set; }
My view looks like this:
<div class="form-group">
<label asp-for="StartOfSit" class="control-label"></label>
<input asp-for="StartOfSit" class="form-control"/>
<span asp-validation-for="StartOfSit" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="EndOfSit" class="control-label"></label>
<input asp-for="EndOfSit" class="form-control" asp-format="{0:d/M/yyyy}"/>
<span asp-validation-for="EndOfSit" class="text-danger"></span>
</div>
Yet even though I tried multiple ways I cannot disable time picker (blue square) from the input field.
EDIT:
Managed to solve it with Type = "date"
but now I cannot change month to be displayed as a number not an actual name, tried with : {0:dd-mm-yyyy}
and didn't work.
Blockquote
Upvotes: 0
Views: 691
Reputation: 840
try with that
[DataType(DataType.Date)]
public DateTime StartOfSit { get; set; }
Upvotes: 2