|
<SfDatePicker TValue="DateTime?" @onblur="@focusOut" @oninput="@inputHandler" @bind-Value='@DateValue' Min='@MinDate' Max='@MaxDate' Format="MM/dd/yyyy" ShowClearButton="true">
</SfDatePicker>
@code {
public DateTime? DateValue { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 10);
public DateTime MinDate { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 05);
public DateTime MaxDate { get; set; } = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 27);
private string inputValue { get; set; }
private void inputHandler(ChangeEventArgs args)
{
inputValue = (string)args.Value;
}
private void focusOut()
{
DateTime parsedDate;
if (!string.IsNullOrEmpty(inputValue))
{
var result = DateTime.TryParseExact(inputValue.ToString(), "MMddyyyy", new CultureInfo("en-US"),
DateTimeStyles.None, out parsedDate);
if (result)
{
DateValue = parsedDate;
}
}
}
} |
Thanks for the answer I have been following the reported bug, there is no exact date when the fix of this bug will be released.
Do you have a date or release version?
I will appreciate your answer
Hi there.
In the "19.1.69" version the bug is fixed, but updating the version to "19.2.44" The bug is still present. You can reproduce it by updating the demo project you attached in your answer updating it to "19.2.44"
.
The issue is when you cleared the date with x button onChange is fired but when you enter a new value onChange is not fired so the value is not parsed.