bug: Setting ion-datetime value does not update selected day
See original GitHub issuePrerequisites
- 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
When setting the value of an ion-datetime
in a setTimeout
, the display date updates, but after opening the datetime, the selected day does not display.
Expected Behavior
After setting the value of a ion-datetime
, the selected day should also update.
Steps to Reproduce
- Have an
ion-datetime
(example usesion-datetime-button
) - Update the value after a few seconds
- Open the date picker
- Observe: The new value does not show as the selected day
- Expected: The new value would display as the highlighted/selected day
Code Reproduction URL
Ionic Info
N/A
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
ion-datetime dynamic value change doesn't work for certain ...
The way I do this is by listening to the ionChange event, detecting the clicked day, calculating the 7 days that belong to...
Read more >ion-datetime - Ionic Framework
Datetimes present a picker interface to select dates and times. Ionic's API Datetime input component easily displays a preferred format, and manages values....
Read more >Date picker popup in Ionic 6 | Damir's Corner
To make the ion-datetime component appear in a popup, place it inside the ion-popover component. To display the selected date on the page,...
Read more >What's new in Ionic 6.2 release | ion-datetime-button - YouTube
Hello Friends, Welcome Back to @CodingTechnyks. In this video, we are going to use new ion - datetime component & ion - datetime...
Read more >How to use the Ionic 6 Datetime component - YouTube
In this video we are taking a closer look at the Ionic 6 datetime component and implement a stylish modal that works for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@liamdebeasi Highlight is OK, thanks, but the picker show the current month, not the set month. This issue is only partially finished.
@aktivdigital-frontend thanks for reporting this issue. I am seeing the same behavior as well.
The datetime has internal logic that requires the date be active & that we should highlight the day: https://github.com/ionic-team/ionic-framework/blob/436a8ce50847d26f8fb63ce64ea85be6f5c0bc8e/core/src/components/datetime/datetime.tsx#L1927
highlightActiveParts
is unfortunately never set when the value is dynamically changed, so the day will never show as selected unless the user manually taps the day again.