jquery datepicker 日期用法

许涵容
2023-12-01
var dates = $( "#createTimeBegin, #createTimeEnd" ).datepicker({
            changeMonth: true,
            changeYear: true,
            numberOfMonths: 2,
            onSelect: function( selectedDate ) {
                var option = this.id == "createTimeBegin" ? "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 );
             }
        });
    var datess = $("#installTimeBegin,#installTimeEnd").datepicker({
        changeMonth: true,
        changeYear: true,
        numberOfMonths: 2,
        onSelect: function( selectedDate ) {
            var option = this.id == "installTimeBegin" ? "minDate" : "maxDate",
                instance = $( this ).data( "datepicker" ),
                date = $.datepicker.parseDate(
                    instance.settings.dateFormat ||
                    $.datepicker._defaults.dateFormat,
                    selectedDate, instance.settings );
            datess.not( this ).datepicker( "option", option, date );
        }
    });
    清空时;
     $("#c0").click(function(){
         $("#createTimeBegin").val("");
         dates.datepicker( "option", "minDate", null);
       });
     $("#c1").click(function(){
         $("#createTimeEnd").val("");
         dates.datepicker( "option", "maxDate", null);
       });
     $("#c2").click(function(){
         $("#installTimeBegin").val("");
         datess.datepicker( "option", "minDate", null);
       });
     $("#c3").click(function(){
         $("#installTimeEnd").val("");
         datess.datepicker( "option", "maxDate", null);
       });
         控件不占用空间
     $("#ui-datepicker-div").addClass("ui-datepicker-multi").addClass("ui-datepicker-multi-2").addClass("timecss");


 类似资料: