Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra day is included in an all day event when created by selecting a section of the calendar #55

Closed
lucaa opened this issue Nov 26, 2020 · 8 comments
Assignees
Milestone

Comments

@lucaa
Copy link

lucaa commented Nov 26, 2020

The calendar macro displays a calendar and allows to create events by operating the calendar (selecting a section of the displayed calendar pops up the event creation modal).

However, when selecting a couple of full days on the calendar (in month view, for example, or on the top of the week view), the event that gets created is one day longer than the selected period.

Steps:

  1. select a piece of the calendar in month mode (e.g. a full week):

image

  1. when the mouse is released, the "add event" popup is displayed:

image

  1. fill in title and description (optional), save

  2. the result is an event that is 1 day longer than the selected period:

image

@lucaa
Copy link
Author

lucaa commented Nov 26, 2020

Indeed the event period can be edited in the "add new event" popup, but the fact that it adds one extra day out of the box is a little misleading...

@acotiuga
Copy link

acotiuga commented Jan 11, 2021

According to https://fullcalendar.io/docs/select-callback, the end date is exclusive and it should be treated as such. There is this demo presented in the same documentation page to https://fullcalendar.io/docs/date-clicking-selecting-demo, where, this can be in action. The days in the calendar are properly selected, nothing extra is added, but the date includes one day after the selection. Selecting 1st, 2nd and 3rd of a month will generate a date range like 2020-12-01 to 2020-12-04, see the 4th day.
Given the fact that on a selection, the event form fills the date inputs with dates at midnight, one option would be to decrease the end date with 1 second obtaining the following result:
selectingEvent
modalEvent
calendarEvent

acotiuga added a commit that referenced this issue Jan 11, 2021
… section of the calendar #55

* the end day will be excluded by simply substracting 1 second from it and setting the new end day as the previous one at 23:59:59
* 12.01.2020 00:00:00 will become 11.01.2020 23:59:59
@acotiuga acotiuga self-assigned this Jan 11, 2021
@acotiuga acotiuga added this to the 2.9.3 milestone Jan 11, 2021
@acotiuga
Copy link

Reopen the issue for some more investigation:
Why the calendar is not producing the same event before(previewed event) and after(generated event) filling the event form?

@acotiuga
Copy link

In the end, the problem is caused by bad handling of the allDay flag. When multiple days are selected and the flag is enabled, the events are marked as all day events and displayed in the all day events sections (when looking on weekly mode of the calendar).
The consequence in this case is that the flag enabled means that the last day, which should be excluded, will actually be included.
On the other hand, if the flag is not enabled, the event will look like an event spanned on the entire day/s, without being added in the all day events section, even if it takes from one day at the midnight to another day at midnight.
A clear view of the differences in the 2 cases is in the following weekly events image:
Screenshot from 2021-01-14 13-21-32

@acotiuga
Copy link

This can be reduced to a problem of allDay flag handling.

@acotiuga acotiuga reopened this Jan 14, 2021
acotiuga added a commit that referenced this issue Jan 15, 2021
…ecting a section of the calendar #55"

This reverts commit 9c0dd3d.
acotiuga added a commit that referenced this issue Jan 15, 2021
… section of the calendar #55

* removed the singleDay variable as it is somehow a redundancy of the allDay (all day for 1 day)
* in case of 1 day event, instead of setting the end day to empty value, set it to the actual end date that results from the event selection in calendar
* the combination of the allDay flag enabled and the end date time with the value 00:00:00 results in adding a new day in the new created event
acotiuga added a commit that referenced this issue Jan 15, 2021
…ecting a section of the calendar #55"

This reverts commit 549c496.
acotiuga added a commit that referenced this issue Jan 15, 2021
… section of the calendar #55

* in order to address a problematic situation from the fullcalendar.io library, one day was adding at the event creation and update
* the upgrade of the fullcalendar version brought the fix so the workaround had to be removed
@acotiuga
Copy link

Closing this issue with the solution that consists of removing a workaround for a fullcalendar.io issue that was fixed in the newest version. fullcalendar/fullcalendar#2909 can be checked for more details.
Note: 549c496 is the only commit that fixes this issue(rest of commits were reverted).

@lucaa
Copy link
Author

lucaa commented Feb 23, 2021

Note: 549c496 is the only commit that fixes this issue(rest of commits were reverted).

@acotiuga you mean d8fbfcf , I assume, 549c496 was reverted or it is 549c496 that was not supposed to be reverted?

@acotiuga
Copy link

@lucaa you are right, d8fbfcf holds the fix for this issue. It was a mention that the rest should be ignored by any interested dev. In addition, being the last one, there was no reason to consider d8fbfcf as reverted.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants