Dhwani
Dhwani

Reputation: 7626

Kendo Scheduler same start and end date for all day event

I want to make start date and end date same for Kendo UI Scheduler when All day event set to false. I tried this on edit:

edit: function (e) {
    e.event.set("isAllDay", false);
    a = e.event.start;
    a.setHours(a.getHours() + 1)
    e.event.set("end", new Date(a));
}

But it is not making end same as start. Can anyone help?

Upvotes: 1

Views: 1824

Answers (1)

Nic
Nic

Reputation: 12875

You're doing this: a.setHours(a.getHours() + 1), which is setting the end date an hour later than the start date.

This works for me:

edit: function (e) {
    e.event.set("isAllDay", false);
    var a = e.event.start;
    a.setHours(a.getHours());
    e.event.set("end", new Date(a));
}

You can use less code too:

edit: function (e) {
    e.event.set("isAllDay", false);
    e.event.set("end", e.event.start);
}

Upvotes: 1

Related Questions