I am using KendoUI scheduler in my application. is there any way to get the start of week when the selected view is week.
问问题
1410 次
1 回答
1
是的。使用导航事件来捕获当前日期并通过操作检索到的日期来获取一周的开始。IE
navigate: function (e) {
if (e.view.toLowerCase() === "week") {
GetStartDateOfWeek(e.date);
}
}
function GetStartDateOfWeek(d) {
d = new Date(d);
var day = d.getDay(),
diff = d.getDate() - day + (day == 0 ? -6:1); // adjust when day is sunday
var startOfWeek = new Date(d.setDate(diff));
}
希望能帮助到你!
于 2014-11-17T14:32:10.190 回答