Home > Net >  Blazor InputData resets after I start typing
Blazor InputData resets after I start typing

Time:09-21

I have the following code in a Blazor Server App form

<InputDate @bind-Value="_myclass.DateCreated" class ="form_control" min ="1753-01-01" max="9999-12-31 id="CreationDate" />

public class MyClass 
{
    public Datetime? DateCreated{get;set;}
}

The issue is when I try to edit the date, if it is set to

07/31/2022 and I click in the date component and try change the month, if I type 01 it changes the value to 01/dd/yyyy

. It has reset the whole date. Is there any way to avoid this?

CodePudding user response:

remove the "?" from public DateTime? DateCreated{get;set;}

  • Related