Hi everyone, I am experiencing an unexpected behavior with the native Date Picker widget in OutSystems ODC Mobile (which uses Ionic's ion-datetime inside an ion-modal under the hood).
The Issue:
When I open the date picker for the first time and select a date, it selects and records the correct date successfully.
However, when I close the modal, reopen it, and select a different day, the component incorrectly jumps to or selects a date from the previous month / incorrect view instead of the targeted date.Has anyone encountered this bug with the mobile Date Picker widget? Is there a recommended fix, workaround, or property adjustment in ODC to force the date picker to correctly sync its active view every time it opens?
Hello @MUNIYASAMY N,
I think this is a bug, as you mentioned. I found these GitHub issues discussing what looks like the same problem:
From my understanding, this appears to be an Ionic Date Picker issue where the selected value is updated correctly, but the calendar doesn't always reopen on the month of the selected date. Instead, it sometimes retains the previously displayed month.
I actually used Claude to better understand the issue and identify a possible workaround. After testing it, the workaround below resolved the problem:
Instead of keeping the same Date Picker instance and relying on it to refresh its internal state, we are forcing the component to be destroyed and recreated. Each time a new date is selected, the old Date Picker instance is removed, and a new instance is created using the newly selected value.