0

I am using KendoUI scheduler in my application. is there any way to get the start of week when the selected view is week.

4

1 回答 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));
 }

希望能帮助到你!

参考:JavaScript - 从当前日期获取一周的第一天

于 2014-11-17T14:32:10.190 回答