Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(mat-date-range-picker): MatEndDate dateChanged is triggered by changes to start and end date #19806

Open
jacobfederer opened this issue Jun 30, 2020 · 1 comment
Labels
area: material/datepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@jacobfederer
Copy link

Reproduction

Stackblitz demo:

https://components-issue-aypuzh.stackblitz.io

Steps to reproduce:

  1. Create a MatDateRangePicker as shown in the docs
  2. Add the dateChanged attribute to matStartDate or matEndDate
  3. Start to change dates

Expected Behavior

What behavior were you expecting to see?

That the date changed attribute on matEndDate is only triggered when you change the end date. Or a way to detect when both start and end date have successfully been set.

Actual Behavior

What behavior did you actually see?

The date changed attribute on matEndDate is triggered both when you change the start and end date.

Environment

  • Angular: 10.0.0
  • CDK/Material: Material 10.0.0
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS
@jacobfederer jacobfederer added the needs triage This issue needs to be triaged by the team label Jun 30, 2020
@jacobfederer jacobfederer changed the title bug(mat-date-range-picker): MatEndDate change propagates changes both from matstartdate and matenddate bug(mat-date-range-picker): MatEndDate dateChanged is triggered by changes to start and end date Jun 30, 2020
@mval1002
Copy link

I just came across the same issue. In my case it was pretty easy to get around by simply adding an if statement at the beginning of the called function checking if end date has a value.

On one hand, I think the current implementation makes sense, as it does set the end date to null after selecting the start date. On the other hand, it would nice to see an Output added to perhaps mat-date-range-input that triggers after both dates are selected

@crisbeto crisbeto added area: material/datepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/datepicker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

3 participants