Kendo Scheduler - Inconsistent date in navigate event handler

0 Answers 113 Views
Scheduler
JA
Top achievements
Rank 1
JA asked on 28 Feb 2023, 07:38 PM

Hi, perhaps this is intended functionality for reasons I'm not understanding, but when navigating within a Kendo Scheduler that has certain view types set (particularly, "week" for my purpose), the date that's received in the "navigate" event handler is inconsistent depending on which direction navigation is performed.

When navigating forward, the e.date value is that of the first day of the currently displayed week, as I would expect. However, when navigating backward, the e.date value is the last day of the displayed week. Is there a reason that the day of week for the event date is not the same regardless of which direction navigation is performed?

The console output of this Dojo exhibits the date discrepancy: https://dojo.telerik.com/eMEtuhAQ/2

Thanks!

Nikolay
Telerik team
commented on 03 Mar 2023, 04:07 PM

Hi J A,

This behavior is by design so. When the user navigates forward the selected date is always the first date from the current view and when they do backward the selected day is always the last date of the view.

You can overcome this by removing the desired number of days when the action is previous:

navigate: function(e) {
          var date = e.date
          if(e.action == "previous") {
            date = new Date(e.date.setDate(e.date.getDate() - 6))
          }
          console.log("date", date);
        }

Dojo demo: https://dojo.telerik.com/ixOlUKOB

Regards,

Nikolay

JA
Top achievements
Rank 1
commented on 03 Mar 2023, 04:11 PM

Thanks! That's the same solution I had implemented to accommodate it, but just wanted to verify that was expected behavior and the correct approach to solve it.
Nikolay
Telerik team
commented on 08 Mar 2023, 10:34 AM

Hi JA,

Yes, this is expected and you can go with this approach.

Please let us know if anything new arises.

Regards,

Nikolay

No answers yet. Maybe you can help?

Tags
Scheduler
Asked by
JA
Top achievements
Rank 1
Share this question
or