I am using a standard date picker with min and max attributes to restrict the date selection. It works fine on web and Android, but it doesn't work as expected on iOS. Can you suggest a solution?
hi @GOKULPRASANTH MUNUSAMY , hope you're doing well.
iOS may ignore the min/max attributes at selection time.Try using an OnChange action on the input date, in the logics compare selcted date with allowed range. If it is outside show a message and reset the value.
If selected_date < min_date or selected_date > max_date: showMessage ("Please select a valid date.") and reset date input.
hope this helps, let me know if u need more info.
thanks and regards!
Thanks for your reply @Wahaj Adil
But I need to disable the Dates in the picker.
Regards,
Gokulprasanth M
@GOKULPRASANTH MUNUSAMY , you may use Js code to achieve this.
Sure @Wahaj Adil I will try
Use JavaScript Validation on Change<script> const input = document.getElementById("myDate"); const minDate = new Date("2024-01-01"); const maxDate = new Date("2025-12-31"); input.addEventListener("change", function () { const selectedDate = new Date(this.value); if (selectedDate < minDate || selectedDate > maxDate) { alert("Date is out of allowed range!"); this.value = ""; // or reset to min/max } });</script>
Thank You
@GOKULPRASANTH MUNUSAMY Flatpickr allows date disabling using Js.
@GOKULPRASANTH MUNUSAMY : Please try DatePickerDisableDays or DatePickerDisableWeekDays from OutSystemsUI to disable Days / WeekDays.
I just encountered the same issue; dates outside the MinDate and MaxDate range were not being disabled on iOS devices.
However, I found a solution: simply use the DatePickerDisableDays function (a built-in datepicker function) and pass one of the dates that falls outside the MinDate and MaxDate range.
For example, if MinDate is 10 and MaxDate is 19, just call DatePickerDisableDays with a date of 9 and put it in the flow that will be triggered before the DatePicker (OnInitialize, for example). This will trigger the disabling of other dates outside the range.
I hope this solution helps.
Thank you.