-2

I am trying to setup the jQuery UI datepicker to have minDate of today and maxDate to at least 18 years; if they choose less than 18 years, it should throw an error:

$('#dateofbirth').datepicker({changeMonth:true,changeYear:true,
minDate: 0, maxDate: '-18Y'});
Pang
  • 9,564
  • 146
  • 81
  • 122
hun ho
  • 3
  • 3

1 Answers1

1

I think this question is already answered:

See this discussion:- jQuery DatePicker Min Max dates

Try something like this :

 $(function() {

        $( "#datepicker" ).datepicker({ 
            changeYear: true,
            minDate: '-3M',
            maxDate: '+28D',
        });
    });

change min and maxDate according to your needs

Mujthaba Ibrahim
  • 207
  • 3
  • 16