angular / angular/components

Bug: Datepicker value change event fires when changing min value of it

Open
#9,295 15 comments 25 reactions 0 assignees View on GitHub
area: material/datepicker P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Bug, feature request, or proposal:
Bug

#### What is the expected behavior?
I am not sure it is expected to behave like that or not, but I think that changing min value of datepicker shouldn't fire value changes event of the form group. I changed value of min date inside subscribe method because I want to have mindate dynamically updated. I checked two conditions one with the formgroup where it happens twice all the time and another condition using just formcontrol this issue happens only first time.
If I comment out the update of the mindate inside subscribe everything will be okay

#### What is the current behavior?
Form Group value change happens when changing Datepicker min value via two way binding, Min value update happens inside Subscribe method. This issue causes to fire valuechanges twice

#### What are the steps to reproduce?
Reproduction is StackBlitz using the formgroup
https://stackblitz.com/edit/datepicker-min-date-bug?file=app/datepicker-min-max-example.ts

#### What is the use-case or motivation for changing an existing behavior?
I think something is odd because different conditions behave differently ( for example as I stated above about formcontrol vs formgroup)

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular Material 5.0.0-rc3

Contributor guide

Open the contributing guide

Research direction

Run the StackBlitz reproduction linked in the issue, starting with app/datepicker-min-max-example.ts and its form-group and form-control cases. Compare value-change emissions when the datepicker min value is updated inside the subscription; done means the behavior is consistent and the unintended duplicate emissions no longer occur.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.