matheo / angular

Open Source Angular Libraries: MatDataSource, MatDatepicker
http://matheo.co/demos/
MIT License
60 stars 15 forks source link

Day remains selected when switching month even when out of min, max range #47

Open conor-mac-aoidh opened 2 years ago

conor-mac-aoidh commented 2 years ago

Describe the bug

When a day is selected in the datetime picker and a min date is specified, an invalid date can easily be selected by switching months & pressing the apply button.

Minimal Reproduction

  1. Create a datetime picker with today as the selected date (eg. 22-11-2021)
  2. Set the minimum date to today + 1 day - 1 month (eg. 23-10-2021)
  3. Open the date picker & navigate to the previous month
  4. A date before the min date is selected (eg. 22-10-2021)

Expected behavior

A date before the minimum date should not be selectable.

Screenshots

image

matheo commented 2 years ago

@conor-mac-aoidh I'm testing this and I see the expected behavior.

Maybe there's a confusion for you because the datepicker marks one date as active but it's not selected because the component didn't output any value, you cannot click on it. You're able to click 23 in your screenshot but 22 cannot be selected, it's just active for keyboard actions.