bug(datepicker): Date range input by keyboard validation is incorrect
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
On a date range picker, write dates in incorrect order (start > end) like `01/01/2012 - 01/01/2011`. The component shows a validation error. After correcting the start date using the keyboard to `01/01/2010`. The error isn't removed until the end date is modified, even setting the same end date using the keyboard.
### Reproduction
StackBlitz link: https://stackblitz.com/run?file=src%2Fapp%2Fdate-range-picker-forms-example.ts
Steps to reproduce:
1. Focus on the start date field.
2. Write (keyboard input) `01/01/2012`
3. Tab to change focus to the end date input field.
4. Write (keyboard input) `01/01/2011`
5. Shift+Tab to return to the start date field.
6. The validation error is shown.
7. Write (keyboard input) `01/01/2010` on the start field.
8. Tab to change focus to the end date input field.order.
9. The validation error is still present even when the dates are in correct order.
10. Delete anything on the end date and add what you deleted again, to have the same end date as before.
11. The validation error disappear.
### Expected Behavior
Correcting the start date on step 7 should fix validation error.
### Actual Behavior
Correcting the start date on step 7 doesn't fix the validation error.
### Environment
@angular-devkit/architect 0.1600.3
@angular-devkit/build-angular 16.0.3
@angular-devkit/core 16.0.3
@angular-devkit/schematics 16.0.3
@angular/cdk 16.0.2
@angular/material 16.0.2
@schematics/angular 16.0.3
ng-packagr 16.0.1
rxjs 7.8.1
typescript 5.0.4
Contributor guide
Research direction
Start with the StackBlitz reproduction in src/app/date-range-picker-forms-example.ts and follow the keyboard-input path for the date-range picker. Reproduce the listed steps, then verify that correcting the start date clears the validation error without modifying the end date.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100