DatePicker maxDate

DatePicker maxDate


I have two fields a start date and end date. What i've done is set the
minDate of start date to today and then i set the minDate of end date
to whatever startDate is set to. This all works fine. The issue is
with setting maxDate of end date. I want to set it to 2months in the
future of whatever the minDate is set to (so basically 2months ahead
of the start date). Everything i've tried to do this has resulted in
random results mostly in disabling any selecting of the date.
[code]
    $('#endDate').datepicker({
        dateFormat: 'dd-mm-yy',
        beforeShow: function(){
            return{ minDate: $('#startDate').datepicker('getDate'),
                    maxDate: $('#startDate').datepicker('getDate') + '+2m'}
        }
    }).attr('readonly', 'readonly');
[/code]
this is an example of my code, the maxDate setting doesn't work but
thought i'd just give an example.