Kobus Myburgh Kobus Myburgh - 10 months ago 131
jQuery Question

Materialize Datepicker prevent end date before start date

For Materialize datepicker, I have found the min and max options for Materialize datepicker, but do not know how to set two datepickers used in conjunction with each other as follows:

  1. User selects a start date.

  2. User now must select an end date, but should not be able to select a date before the start date.

  3. Should the user select the end date first, he/she should not be able to select a start date after that end date.

I am not a javascript programmer, so not sure how to even start this. From my guesses, I would need to put some code in the onSet event of each datepicker.

I am also trying to do the same for the timepicker: http://weareoutman.github.io/clockpicker/jquery.html.

Can someone please assist with this code or another solution?

Answer Source

Settled for server side validation. There seems to be no way to do this on client side with the materialize plugin.