IgniteUI / igniteui-react

High-Performance Data Grid and High-Volume Data Charts
Other
6 stars 1 forks source link

Cannot set value of date picker to undefined #69

Closed wnvko closed 5 months ago

wnvko commented 6 months ago

Description

I have a date picker bound to a variable. I am trying to delete its value by clicking on delete button.

Steps to reproduce

Setup the date picker like this:

<IgrDatePicker value={date} selectedValueChanged={(_s, e) => setDate(e.newValue)} label="Date"></IgrDatePicker>

Select a date in the picker and then delete it via click on delete button (the x next to the calendar icon).

Result

The value of the picker becomes 01/01/0001.

Expected result

The value should become undefined or null.

wnvko commented 6 months ago

Same issue is valid for the calendar!

MayaKirova commented 5 months ago

@wnvko It seems that that is the default behavior of the igcDatePicker. If you delete the value and then check the property it seems to return Mon Jan 01 0001: image The IgrDatePicker does the same since it simply wraps the IgcDatePicker.

Perhaps this should be logged here to be fixed in the igc component: https://github.com/IgniteUI/igniteui-webcomponents/issues

damyanpetev commented 5 months ago

That'd be the old date picker then, it's replacement is imminent but not out just yet https://github.com/IgniteUI/igniteui-webcomponents/pull/1086. Not sure if an issue for the old will be prioritized at this point. The other bit that irks me still the comment about the calendar, since this time the WC component accepts it and clears just fine: image If that's not the case in React there might still be an issue somewhere.

MayaKirova commented 5 months ago

@damyanpetev @wnvko As far as I can tell the calendar doesn't have an issue with undefined as a value. It clears correctly and when checking the value it return undefined as expected: https://codesandbox.io/p/sandbox/fervent-borg-7n5fsh Let me know if I'm missing something.