Skip to content

DatePicker updates year/months before setting YearRange which can cause a crash #2250

@melfon

Description

@melfon

Describe the bug
Setting a Max year below the default YearRange "1950:2055" will cause a crash if the no value has been set to Min.

The method UpdateYearsAndMonths is called from SetParametersAsync before any new YearRange has been applied. Since the YearMin will be set to the default 1950 since no Min has been set, YearMax will be less than YearMin causing a crash.

To Reproduce
Set Max to "1948-01-01" with the Min parameter not set (=null).

Solution
The simplest solution is to set a flag if Max or Min has changed in method SetParametersAsync and call UpdateYearsAndMonths after all parameters has been updated.
Also verify that YearFrom < YearTo to avoid crashes for bad input parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions