I have a datepicker field that the maxDate doesn't seem to be working on.

jQuery:

$(document).ready(function() {
    $("#intorgDate").change(function() {
        var myDate = new Date($("#intorgDate").val()); //ENTER VALUE IN mm/dd/yy FORMAT
        var mymaxDate = new Date(myDate +7);
        $('#intnewDate').datepicker({
            inline: true,
            dateFormat: "mm/dd/yy",
            changeFirstDay: false,                  
            defaultDate:myDate,
            minDate: myDate,
            maxDate: mymaxDate
        });
    });
});​

HTML:

org date:<br>
<input type="text" id="intorgDate" /><br>
new date:<br>
<input type="text" id="intnewDate" /><br>​

I have also tried setting maxDate to: maxDate: myDate 7, maxDate: myDate +7, and myDate "+7" - All with no luck.

You can see it in action here: http://jsfiddle.net/eQRqt/30/

What am I missing?

Finally got this working with:

//Destroy Previous Datepicker
$('#intnewDate').datepicker("destroy");
//Create New Datepicker
var orgDate = $.datepicker.parseDate('mm/dd/yy', $('#intoriginalDate').val());
orgDate.setDate(orgDate.getDate());
var maxDate = $.datepicker.parseDate('mm/dd/yy', $('#intoriginalDate').val());
var maxDays = parseInt(23);
maxDate.setDate(maxDate.getDate() + maxDays);
$('#intnewDate').datepicker({
    inline: true,
    beforeShowDay: noWeekendsOrHolidays,
    dateFormat: "mm/dd/yy",                  
    defaultDate:orgDate,
    minDate: orgDate,
    maxDate: maxDate
});

Hopefully someone can find this usefull.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.