Inconsistencies in end date of view modes

Ask for help related to our Calendar 2.x version
Post Reply
User avatar
paulb
Posts: 12
Joined: Thu Apr 11, 2019 9:47 am

Inconsistencies in end date of view modes

Post by paulb » Thu Mar 05, 2020 8:57 am

Hi,
I am currently working with the start (getStartDate) and end date (getEndDate) of the currently shown mode and found some inconsistencies.
See this screenshot:
date inconsistencies.png
date inconsistencies.png (33.83 KiB) Viewed 893 times
Day and week mode behave consistent (as expected) but month, year and arguably agenda are off.
The month mode should return all visible days, i.e. start of the first week in the month plus six weeks.
The year mode needs an extra second to be consistent.
The agenda mode currently displays the range in which the events occur, i.e. min start date and max start date. I would propose that the current date (which is also shown) is considered when calculating thet start and end date. In my case I load additional data based on the start and end date.

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2579
Joined: Fri Apr 01, 2016 11:08 am

Re: Inconsistencies in end date of view modes

Post by pmiklashevich » Tue Mar 10, 2020 6:14 pm

What is your "checkDates()"? If you call Calendar.getActiveView().getEndDate(), getEndDate is a private method. Why do you need to know what the start/date of the range is?
According to Agenda view, it shows all data in the store always, so start end date matches the first event start and the last event end dates in the store.
According to Month and Year views will discuss the possibility to make end date inclusive. And we will discuss if it's a reasonable to have getStartDate/getEndDate public for modes/views.
Pavel Miklashevich - Core Developer

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2579
Joined: Fri Apr 01, 2016 11:08 am

Re: Inconsistencies in end date of view modes

Post by pmiklashevich » Tue Mar 10, 2020 6:48 pm

Thanks for the report! Your report helped to reveal a bug in generating recurring events. Ticket here: https://app.assembla.com/spaces/bryntum/tickets/9530-occurrences-are-missing-for-next-year-shown-in-the-end-of-current-year/details
We will change those functions to return all visible interval inclusive, and will make them public. Cheers!
Pavel Miklashevich - Core Developer

User avatar
paulb
Posts: 12
Joined: Thu Apr 11, 2019 9:47 am

Re: Inconsistencies in end date of view modes

Post by paulb » Tue Mar 10, 2020 9:14 pm

_checkDates_ is only a simple function that logs the current mode, startDate and endDate, nothing fancy.
My use case is to only load additional events that are within the visible boundaries to reduce the transmitted data. Therefore I use the startDate and endDate to set an appropriate filter. For the agenda view this means that the current date (which is always rendered) must be included for the calculation of the start and end date.

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2579
Joined: Fri Apr 01, 2016 11:08 am

Re: Inconsistencies in end date of view modes

Post by pmiklashevich » Wed Mar 11, 2020 12:16 pm

Yes, in Agenda mode current date is always included.
Pavel Miklashevich - Core Developer

User avatar
paulb
Posts: 12
Joined: Thu Apr 11, 2019 9:47 am

Re: Inconsistencies in end date of view modes

Post by paulb » Fri Mar 13, 2020 5:00 pm

I found a bug in the Agenda mode endDate calculation. Consider this data:
agenda-bug-data.png
agenda-bug-data.png (29.65 KiB) Viewed 792 times
The Agenda mode returns the 20th as end date which is incorrect as it should be the 23rd.

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2579
Joined: Fri Apr 01, 2016 11:08 am

Re: Inconsistencies in end date of view modes

Post by pmiklashevich » Fri Mar 13, 2020 8:11 pm

How can we reproduce it with our demos? Please provide your dataset and tell us what the current date is.
Pavel Miklashevich - Core Developer

User avatar
paulb
Posts: 12
Joined: Thu Apr 11, 2019 9:47 am

Re: Inconsistencies in end date of view modes

Post by paulb » Mon Mar 16, 2020 9:20 am

Sorry, this was an error on my part. Your implementation is correct. I changed the agenda view to show multi-day events on every day so in my agenda view the event is displayed until its end hence the "bug".

Post Reply