IgniteUI / igniteui-webcomponents

Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
https://www.infragistics.com/products/ignite-ui-web-components
Other
113 stars 2 forks source link

Date picker with no value #1205

Open wnvko opened 1 month ago

wnvko commented 1 month ago

Description

I am trying to clear the value of the date-picker or to set it to nullable data.

Steps to reproduce

Use code like this:

@state()
private undefinedDate?: Date;

...

<igc-date-picker .value=${this.undefinedDate}
        selectedValueChanged=${(_s: IgcDatePickerComponent, e: IgcSelectedValueChangedEventArgs) => this.undefinedDate = e.newValue}>
</igc-date-picker>

or like this:

@state()
private definedDate?: Date = new Date();
...
<igc-date-picker .value=${this.definedDate}
        selectedValueChanged=${(_s: IgcDatePickerComponent, e: IgcSelectedValueChangedEventArgs) => this.definedDate = e.newValue}>
</igc-date-picker>

Result

In first case application throws an error - Cannot read properties of undefined (reading 'getHours'). In second case if I click on clear value button the value of the date picker becomes 01.01.0001 instead of undefined or null.

Expected result

Data picker should be able to accept nullable values as its value.