// 日期范围 $('.gap-date').datepicker({ changeYear: true, changeMonth: true, maxDate:null, onClose: function(selectedDate) { var y, m, d; var arr = selectedDate.split('-'); y = arr[0]; m = arr[1] - 7; d = arr[2]; $('.date').datepicker('option','maxDate', new Date(y, m, d)); } });