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.