2011-12-28 84 views
0

2012日期沒有被禁用,我不明白爲什麼,我已經嘗試過每種日期格式也沒有喜悅 - 任何想法?jQuery Datepicker不禁用2012日期

<script type="text/javascript"> 
    var unavailableDates = ["27-12-2011", "28-12-2011", "29-12-2011", "03-01-2012", "09-01-2012", "26-01-2012", "14-02-2012"]; 
    function unavailable(date) { 
     dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear(); 
     if ($.inArray(dmy, unavailableDates) == -1) { 
      return [true, ""]; 
     } else { 
      return [false, "", "Unavailable"]; 
     } 
    } 
</script> 
<script type="text/javascript"> 
    $(function() { 
     $("#datepicker").datepicker({ 
       beforeShowDay: unavailable, 
       minDate: 0 
     }); 
    }); 
</script> 

回答