I'm working on a simple website to try out some Blazor (I'm a rookie). I have created a binding with a string value "08:00" and bind i to a input field as shown:
<input @bind-value="@StartValue" @bind-value:event="onchange" class="col-sm-1" type="time"/>
@code {
public string StartValue { get; set; } = "08:00";
}
This generates the error "cannot convert from 'string' to 'System.DateTime'". However, when I remove my binding and create my input as following: it works fine.
<input value="08:00" class="col-sm-1" type="time"/>
Any idéeas why there's a difference? It doesn't make sense to me to use a DateTime, I would agree if I could use a TimeSpan but that doesn't work either.
bindinstead ofbind-value? - Ehsan Sajjad