我正在使用以下代码格式化日期并在日历中显示2个月...
<script>
$(function() {
var dates = $( "#from, #to" ).datepicker({
showOn: "button",
buttonImage: "imgs/calendar-month.png",
buttonImageOnly: true,
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 2,
onSelect: function( selectedDate ) {
$( ".selector" ).datepicker({ defaultDate: +7 });
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", "dateFormat", 'yy-mm-dd' );
}
});
});
</script>
问题是我不确定如何限制以前的日期选择。