How is your experience with the OutSystems Community?
8
Views
1
Comments
ODC Mobile Date Picker Widget: Re-opening modal selects incorrect date/previous month
Application Type
Mobile

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:

  1. When I open the date picker for the first time and select a date, it selects and records the correct date successfully.

  2. 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? 

Orientation.oml
2026-06-20 17-43-43
Sherif El-Habibi
Champion

Hello @MUNIYASAMY N,

I think this is a bug, as you mentioned. I found these GitHub issues discussing what looks like the same problem:

  • https://github.com/ionic-team/ionic-framework/issues/26391
  • https://github.com/ionic-team/ionic-framework/issues/25257

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:

  • Create two local variables:
    • SelectedDate (Date, bound to the picker's value)
    • ShowDatePicker (Boolean, default True, controls the widget's visibility)
  • Wrap the Date Picker widget in an If, using ShowDatePicker as the condition.
  • In the OnDaySelect event handler:
    1. Assign the selected date to SelectedDate (so the recreated widget initializes with the correct value).
    2. Set ShowDatePicker = False.
  • Add a JavaScript node with a short setTimeout that calls $resolve() (see screenshot). This forces a render cycle in between. Without it, the False and True assignments are batched together, so the widget is never actually destroyed and recreated think of it like buying sometime for the browser to process this.
  • Finally, set ShowDatePicker = True. A new Date Picker instance is created, which initializes from SelectedDate and opens on the correct month.

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. 


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.