bug(datepicker): Duplicate marker on calendar pop up when inputting date that is outwith min/max dates
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
### 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
I have set the min and max dates using their respective properties. When I type in a date that is after the max date, and then open the calendar, a marker appears on both the date I typed in and the max date. This behaviour could arguably be slightly confusing to the user but it is particularly misleading in the instance that the highlighted max date is actually disabled due to custom validation. The same issue can be seen for the minimum date.

### Reproduction
StackBlitz link: https://stackblitz.com/run?file=package.json (an example from the docs)
Steps to reproduce:
1. In datepicker-min-max-example.ts, adjust the max date so that it is not the last day of the month (so that the issue can be seen) e.g. change it to the 15th
2. In the input, type in a date which is after the max date - e.g. the 18th
3. Open the calendar and you will see that two dates are highlighted - the date that was typed in and the maximum date.
4. Provide a custom validator that would render the maximum date disabled e.g. if the max date was a Sunday but weekends are not allowed. Repeat steps 2 & 3 and you will see that this date is highlighted even though it is invalid.
5. Same steps for minimum date.
### Expected Behavior
I am expecting to see only one date highlighted on the calendar - just the (invalid one) that was typed in. If this is not desired, then it should still take into account other invalid/disabled dates through customer validator, so it should highlight the maximum valid date rather than the general maximum date regardless of its validity. Likewise for the minimum date.
### Actual Behavior
I saw two dates highlighted on the calendar - the date I typed in and the maximum date. The maximum date is also highlighted even when it has been rendered invalid by a custom validator, which could be misleading to users - this is the main issue. Likewise for the minimum date.
### Environment
- Angular: 16.1.6
- CDK/Material: 16.1.6
- Browser(s): Google Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
コントリビューションガイド
調査の方向性
StackBlitz の例と datepicker-min-max-example.ts を使用して問題を再現し、まず説明されている min/max と custom-validation の手順を確認します。カレンダーが入力された日付と境界日をどのようにマークするかを追跡し、境界の一方が無効または無効化されている場合に、適切な日付だけがハイライトされたままになることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- frontend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100