3

jQuery ui 日付ピッカー (日付範囲) を使用しています 6 か月に制限したい

var dates = $("#availability_date_from, #availability_date_to").datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 1,
        minDate:'0',

        yearRange:'c-18:c',

        onSelect: function( selectedDate ) {

            var option = this.id == "availability_date_from" ? "minDate" : "maxDate",

                instance = $( this ).data( "datepicker" ),

                date = $.datepicker.parseDate(
                    instance.settings.dateFormat ||
                    $.datepicker._defaults.dateFormat,
                    selectedDate, instance.settings );
            dates.not( this ).datepicker( "option", option, date );


            if(this.id == "availability_date_to"){

                commonJSComplete(this.value,'availability_date_to');
                $('#responsecontainer').load('profilemeter.php');
            }
            else if(this.id == "availability_date_from"){
                commonJSComplete(this.value,'availability_date_from');
            }

        }

    });
4

2 に答える 2

9

試す:


var dates = $("#availability_date_from, #availability_date_to").datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 1,
        minDate:'0',
        maxDate: '+6m',   //add this
..... 
于 2012-04-25T07:57:13.687 に答える