Skip to content

fix(material/datepicker): range input controls dirty on init #21223

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

Merged
merged 1 commit into from
Jan 8, 2021

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Dec 5, 2020

Fixes that the date range input controls were marking each other as dirty on initialization. This seems like an easy fix on the surface, but it's somewhat tricky, because while we usually don't want the inputs to respond each other's events, we still want it to happen if an end date before the start date is assigned.

These changes resolve the issue by not having the inputs respond to any events from inside the input, but notify each other when a value is assigned programmatically.

I've also cleaned up some unnecessary code and added more test cases for things that tripped me up while fixing the issue.

Fixes #20213.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release labels Dec 5, 2020
@crisbeto crisbeto requested a review from mmalerba as a code owner December 5, 2020 15:40
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 5, 2020
Fixes that the date range input controls were marking each other as
dirty on initialization. This seems like an easy fix on the surface, but it's
somewhat tricky, because while we usually don't want the inputs to
respond each other's events, we still want it to happen if an end date
before the start date is assigned.

These changes resolve the issue by not having the inputs respond
to any events from inside the input, but notify each other when
a value is assigned programmatically.

I've also cleaned up some unnecessary code and added more test
cases for things that tripped me up while fixing the issue.

Fixes angular#20213.
@crisbeto crisbeto force-pushed the 20213/date-range-dirty-on-init branch from dcc63ec to 66ecb5b Compare December 5, 2020 16:07
Copy link
Contributor

@wagnermaciel wagnermaciel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Dec 7, 2020
@annieyw annieyw added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Jan 8, 2021
@annieyw annieyw merged commit 4b16025 into angular:master Jan 8, 2021
wagnermaciel pushed a commit to wagnermaciel/components that referenced this pull request Jan 14, 2021
…#21223)

Fixes that the date range input controls were marking each other as
dirty on initialization. This seems like an easy fix on the surface, but it's
somewhat tricky, because while we usually don't want the inputs to
respond each other's events, we still want it to happen if an end date
before the start date is assigned.

These changes resolve the issue by not having the inputs respond
to any events from inside the input, but notify each other when
a value is assigned programmatically.

I've also cleaned up some unnecessary code and added more test
cases for things that tripped me up while fixing the issue.

Fixes angular#20213.
@itayperry
Copy link

Is there any way to use this fix? I'm using Angular 11 and just updated Angular Material to 11.0.4 :)
Currently, the issue still persists.

@crisbeto
Copy link
Member Author

The fix is in the 11.1.0 release. You can either update to the RC version that is already out or wait until the stable version is released.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(matStartDate,matEndDate): matStartDate & matEndDate in mat-date-range-input are touched and dirty from the beginning
5 participants