stefanuebe/vaadin-fullcalendar

Adjusting RecurringDaysOfWeek based on Delta

Opened this issue · 4 comments

This is somewhat related to #188

How recurring days of week should be updated, when doing drag and drop on recurring events and using delta to adjust the time and date information?

Delta has fields for amount of years and months, but its unclear how much weekdays should be incremented based on those as the amount of days in a year or in a month varies.

EDIT:

One way to do this, is to use the LocalDate of RecurringEndDate or RecurringStartDate to roll over the weekday, but those are not always defined.

I am not sure if I understand this issue or what it is about. Is this just a "how to" question or is there an error to be fixed / enhancement to be integrated?

Yes, my original post was a bit vague. I will clarify the problem.

Suppose we have an event like this https://codepen.io/JaakkoHintsala/pen/JjVOVyG?editors=0010 and it is dragged. We get a delta that says it has been dragged by one month. As a month may have 28. 29 , 30 or 31 days, the days of weeks can't be reliably adjusted based on this information.

I don't have a solution to this problem in this case.

I tested it with the multi month view in my demo, Playground page.

  • Dragging an event in the latest version of the addon always resulted in having the delta providing days, not months. So when dragging something from the 31.03. to the 29.02. resulted in a delta of days: -31, not month: -1. In the opposite direction it is days: 31.
  • Dragging something from the 20.02. to the 20.03. results in a delta of days: 29.
  • Dragging something over multiple months resulted in a huge days delta, e.g. 60 days.

So from my pov this is not an issue regarding day calculation. Can you provide me your Java sample code, that resulted in a month based delta?

I also tried it in some views now and it seems to be the case indeed that only the days field is used. I assumed that since the month and year fields existed on the Delta class, that they would be used under certain circumstances.

I looked at the vanilla Fullcalendar docs regarding eventDrop and this behaviour is not documented there, but I guess it's safe to assume they are not changing it anytime soon.

Perhaps it is warranted to leave a note about this behaviour to the Delta java class to avoid confusion?