Problem/Motivation
Within Smart Date we need to process date and time changes from drag and drop events in the Fullcalendar View. In the process, we need to distinguish between all day events and zero duration events, which is currently difficult.
In our FullcalendarViewProcessorBase implementation we set any events that Smart Date consider to be all day to have an "end" value one day after the start, and we set the "allDay" value to true.
In our controller that processes the request at the end of a drag-and-drop event, the request has identical start and end values for these all day events, and the allDay property is not passed.
Proposed resolution
Probably the easiest would be if the allDay property could be included in the request if set, but open to suggestions on other ways to handle this, especially if they could be supported by the current version of Fullcalendar View.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | fullcalendar-modify-timezone.patch | 939 bytes | chrisck |
Issue fork fullcalendar_view-3213979
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mandclu commentedAs an update, it seems that part of my challenge is that zero duration events (where the start and end are identical) and all day events both return the "end" as empty. If zero duration events could return the end as identical to the start, that would be sufficient to differentiate between a zero duration event starting at midnight and an all day event.
Comment #3
mingsongThis module is under 'Bug fixing only' status.
So this new feature won't be delivered.
Sorry.
Comment #4
chrisckHi @Mingsong there is a bug with the event dragging as previously reported by @mandclu. The bug is in the eventDrop callback function in fullcalendar_view/js/fullcalendar_view.js on line 221:
I've read through your comments and I understand why we need to subtract one day from the end date, however the following if() statement isn't triggering. So I printed the end date value to an alert and found the issue:
The end date alert is showing as:
This is why the if() statement isn't getting triggered, because the hours don't match up. So I updated the if() statement and the end date is now getting subtracted by one day as originally intended.
if (end.getHours() == 17 && end.getMinutes() == 0 && end.getSeconds() == 0) {I'm not sure if this is the ideal solution, but definitely highlights some work needed here. I'm not sure where the 17:00:00 GMT is coming from, is this just a default value if the date value is null?
Lastly, the same issue is present in the eventResize() callback on line 84.
Comment #5
chrisckI've just tested this issue with FCV and Drupal core's date range field type and the issue still exists.
Steps to reproduce issue:
Comment #6
mingsongThe 17:00 should be coming from the jet lag, that saying it depends on what Timezone the server is in and the client browser is set.
We can’t simply use the specific time difference as the indicator, in your case is “17:00:00”. As a contribute module, it should work for all Timezone.
Comment #7
chrisckThere seems to be a mix up of the date functions used getHours(), getMinutes(), getSeconds() with local and UTC time.
The if() statement is not getting triggered because end constant for all day events is 00:00:00 in UTC time, not local time. But the functions mentioned above is looking at local time. I'm uploading a patch that takes this into account, which I've tested to be working in my setup.
Comment #8
chrisckComment #9
mingsongSounds reasonable move.
Let's see what feedback on the patch from others.
Comment #10
jeff-davrf commentedThis patch fixed the bug for me. I think it would be a very good idea to approve this patch because without it the wrong date is set when you drag and drop or move the end date on the calendar. This means that without the patch every time the event is dragged to a new start date it adds a day to the end of the event.
Comment #11
erutan commentedThe patch in comment #7 has been working great for months across a few different calendars built.
Comment #14
mingsongThanks everyone.