Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
- Nightly
Current Behavior
If you change the value of an ion-datetime programatically, and then open the ion-datetime, the calendar grid still displays the month/year of the old date.
E.g. if you programatically change the date from today to May 5, 2022, and then open the ion-datetime, the calendar grid will show today's month instead of May 2022 (if you do then navigate to May 2022, you will see that May 5 is correctly selected, but it should have opened there in the first place)
Expected Behavior
Upon opening the ion-datetime, I would expect the calendar grid to initially display the month/year of the selected date.
Steps to Reproduce
- Start with an ion-datetime, which defaults to today's date
- After 4 seconds, programatically update the date to May 5, 2022
- Open the date picker
The date picker shows the current month, instead of showing May 2022
(if you navigate back to May 2022, you will see that May 5 is highlighted as expected, but the date picker should have opened in that month to start with)
Code Reproduction URL
https://stackblitz.com/edit/angular-ramjpp-zz9vub?file=package.json
Ionic Info
Stackblitz
Additional Information
Prior to 6.3.2, the selected date was not updated either. This was reported in #25776, and I have used that as a template for this issue. Although the selected date does now get updated, the calendar grid does not open to the correct month, hence this new issue.