bootstrap embedded / inline datepicker上个月在setDates上展示

时间:2015-02-19 06:45:33

标签: javascript jquery twitter-bootstrap datepicker

我正在使用bootstrap datepicker而我正在尝试从返回的日期数组中设置日期(事件),但是当我使用datepicker的方法(setDates)设置日期时,它会显示最后一个日期的月份在事件数组中,如何让它返回当前月份。

var events = ['02/02/2015','02/05/2015','02/09/2015','03/09/2015'];

    $('.calendar').datepicker({
                multidate: true,
                daysOfWeekDisabled: "0,1,2,3,4,5,6",
                todayHighlight: true
    });

    $('.calendar').datepicker('setDates', events);

JSFiddle

1 个答案:

答案 0 :(得分:1)

Demo

试试这个

 var todayDate = new Date()
var events = ['02/02/2015','02/05/2015','02/09/2015','03/09/2015',todayDate ];

    $('.calendar').datepicker({
                multidate: true,
                daysOfWeekDisabled: "0,1,2,3,4,5,6",
                todayHighlight: true
    });

    $('.calendar').datepicker('setDates', events );