datepicker - disabling past dates

datepicker - disabling past dates

Hi,

I want to be able to disable the ability to select past dates with the datepicker, I believe it has something to do with 'min date' but cant work out how to so it...

here is my code so far:

  1. <script>
        $(function() {
            var dates = $( "#from, #to" ).datepicker({
                dateFormat: 'dd MM yy',                                     
                defaultDate: "+0d",
                changeMonth: false,
                numberOfMonths: 1,
                showOn: 'both',
                buttonImage: 'contact/calendar/calendar.gif',
                buttonImageOnly: true,
                onSelect: function( selectedDate ) {
                    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", option, date );
                }
            });
        });
        </script>