我想在caleran date Picker中徘徊整整一周

时间:2018-10-13 09:49:51

标签: jquery

我在我的项目中使用Caleran作为日期选择器。在这种情况下,当用户单击任意日期时,我将选择一个特定的星期,如下图所示。

enter image description here 我想将鼠标悬停在任何一周的任何日期,所以我要做的事情

我有相应的代码

$("#caleran-ex-1").caleran({
        startOnMonday: true,

        calendarCount: 1,
        //select a whole week in a row...
        onfirstselect: function(elem, start) {
            console.log(elem.config.startDate.format('dddd'));
            if (elem.config.startDate.format('dddd') == "Sunday") {
                elem.config.startDate = moment(start).startOf("week").subtract(6, "days");
                elem.config.endDate = moment(start);
            } else {
                elem.config.startDate = moment(start).startOf("week").add(1, "days");
                elem.config.endDate = moment(start).endOf("week").add(1, "days");
            }
            elem.globals.endSelected = true;
            elem.globals.startSelected = false;
            elem.globals.hoverDate = null;
            elem.$elem.find(".caleran-apply").removeAttr("disabled");
            elem.updateInput();
            console.log(elem.config.startDate.format("DD/MM/YYYY") + " - " + elem.config.endDate.format("DD/MM/YYYY"));
        },
    });

0 个答案:

没有答案