angular / angular/components

bug(MatDatePicker, MatStepper): Min/Max validation on Datepicker doesn't update on step change in Stepper

未关闭
#20,114 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: material/datepicker G P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

#### Reproduction
https://stackblitz.com/edit/angular-9-material-starter-ctvwko

Steps to reproduce:
1. Set dates on step one to be valid (for example: 20/07/2020 - 27/07/2020)
2. Go to step two on mat-stepper then back to step one.
3. Change dates to be the same (25/07/2020 - 25/07/2020)
4. Go to step two on mat-stepper then back to step one.
5. Change dates to be in range from first repro step and different than step 3. (for example 20/07/2020 - 23/07/2020).
6. Error appear `{ "matDatepickerMin": { "min": "2020-07-24T22:00:00.000Z", "actual": "2020-07-22T22:00:00.000Z" } }`. It's min date from repro step 3.


#### Expected Behavior
Error shouldn't appear as date is in valid range.

#### Actual Behavior
Datepicker doesn't revalidate form control when step is changed.

#### Environment

- Angular: 9.1.2
- CDK/Material: 9.2.1
- Browser(s): All
- Operating System: Windows

贡献指南

打开贡献指南

调研方向

从链接的 StackBlitz 复现开始,按照列出的导航和日期更改跟踪 MatDatePicker 和 MatStepper 的行为。当在步骤之间返回会使日期控件重新进行验证,从而有效的日期范围不再保留之前的 matDatepickerMin 错误时,修复就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。