jQuery Datepicker没有禁用2012日期

时间:2011-12-28 01:37:02

标签: jquery date 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>

1 个答案:

答案 0 :(得分:0)

领先的零是你的垮台:http://jsfiddle.net/zvKPe/