I am using KendoUI scheduler in my application. is there any way to get the start of week when the selected view is week.
Asked
Active
Viewed 1,501 times
1 Answers
1
Yes. Use the navigate event to catch current date and get the start of week by manipulating the retrieved date. i.e.
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));
}
Hope it helps!
Reference: JavaScript - get the first day of the week from current date

Community
- 1
- 1

Satya Ranjan Sahoo
- 1,086
- 7
- 24