views:

15

answers:

0

Hi all,

I have a simple Jquery Datepicker calendar, and I need to display only the months from April to October.

I done this by using the following code.

Now I need to do a modification in order to be displayed the same months but for both 2010 and 2011.

More clear, The calendar needs to have for 2010 the months from April to October and the same months for 2011

 $("#<%=CheckInTXT.ClientID %>").datepicker({
        dateFormat: 'M d, yy',
        navigationAsDateFormat: true, prevText: 'M', nextText: 'M',
        changeMonth: true,
        beforeShow: customRange,
        onSelect: function (value, date) {
            var d2 = new Date(value);
            d2.setDate(d2.getDate() + 1);

            var CheckOutDate = $.datepicker.formatDate('M d, yy', new Date(d2.getFullYear(), d2.getMonth(), d2.getDate()));
            $('#<%=CheckOutTXT.ClientID%>').val(CheckOutDate);
        }
    });

    $("#<%=CheckOutTXT.ClientID %>").datepicker({
        dateFormat: 'M d, yy',
        beforeShow: customRange
    });

function customRange(input) {
    var min = new Date();
    var min = new Date(2010, 4 - 1, 29)
    var max = new Date(2010, 10 - 1, 31)
    var dateMin = min;
    var dateMax = max;

    if (input.id == "<%=CheckInTXT.ClientID %>" && $("#<%=CheckOutTXT.ClientID %>").datepicker("getDate") != null) {
        if (dateMin < min) {
            dateMin = min;
        }
    }
    else if (input.id == "<%=CheckOutTXT.ClientID %>") {
        if ($("#<%=CheckInTXT.ClientID %>").datepicker("getDate") != null) {
            dateMin = $("#<%=CheckInTXT.ClientID %>").datepicker("getDate");
        }
    }
    return {
        minDate: dateMin,
        maxDate: dateMax
    };
}

Thanks is advance