ant-design-blazor icon indicating copy to clipboard operation
ant-design-blazor copied to clipboard

DatePicker: picker value not updated

Open Abin-Liu opened this issue 2 years ago • 3 comments

Describe the bug

The picker value is not updated if the Value of a <DatePicker> is changed programmatically.

Steps to reproduce (please include code)

<DatePicker
	@bind-Value="_date"
	TValue="DateTime"
	Picker="@DatePickerType.Date"
/>

<Button Type="primary" OnClick="OnClick">Test</Button>

@code
{	
	DateTime _date = DateTime.Today;	

	void OnClick()
	{
		_date = new DateTime(2021,  2,  15);
	}	
}

If you click the "Test" button value of the <DatePicker> is changed to DateTime(2021, 2, 15), however, the picker still stays on previous value DateTime.Today if you open it.

Actually, for a <DatePicker> or <RangePicker>, any changes make to their Value programmatically after OnAfterRender will not affect the picker, you must directly click date values on the picker panels, that should be a bug.

Further technical details

  • AntDesign Nuget Package version: 0.11.0
  • Include the output of dotnet --info: 5.0
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version: Visual Studio 2022 Community

Abin-Liu avatar Jun 25 '22 04:06 Abin-Liu

Hi @Alexbits , may I ask whether this problem has been fixed in the previous PR?

ElderJames avatar Jun 30 '22 05:06 ElderJames

Hi @Alexbits, may I ask whether this problem has been fixed in the previous PR?

Hey @ElderJames, it's not. From what I see, the Value of DatePicker is updated, but sometimes, it does not re-render to show the change. I will check this later.

Alexbits avatar Jun 30 '22 06:06 Alexbits

Ok, thanks so much!

ElderJames avatar Jun 30 '22 06:06 ElderJames