I have a small but interesting problem which I can't wrap my head around. I have a custom DatePicker component which uses TValue as Value (generic, you can pass DateTime or DateTime? as TValue). And inside a calendar I have button 'x' which clears the Value to default of TValue
[Parameter]
public EventCallback<TValue> ValueChanged { get; set; }
protected async void ClearInputData()
{
await ValueChanged.InvokeAsync(default(TValue));
Value = default(TValue);
selectedHour = 0;
selectedMinute = 0;
selectedSecond = 0;
OnInput?.Invoke();
}
The problem is that default(TValue) if TValue == DateTime is null, and you cannot invoke null; What could be the smartest way ot getting around this?
async Taskmethod and see if the problem persists. If so, post exact error messages or other results.