All day, multi day event is moved to wrong date on calendar
See original GitHub issueI am having a very confusing and frustrating bug.
It happens when I create a multiple day event that is also an ‘All Day’ event. The event is sort of there for single day events, but for whatever reason, they appear unaffected in the calendar view.
JSBin is http://jsbin.com/zewegexihi/edit?js,output
The data is collected from a json feed of events where the time and date were set with a datetime picker extension for bootstrap, and then a user can click a checkbox to set an event to ‘All Day’ even if they have already set a start and end time (which explains the very specific start and end times on all day events)
‘Event 2 - Conference’ is set to be starting on October 19th, and ending on the 23rd, but the calendar displays it as ending one day too early.
I have included a console.log to output the event object being clicked, but the jsbin console is not that great, so I will include output from my local copy, which is using the exact same data:
_d: Sun Oct 18 2015 18:00:00 GMT-0600 (MDT)
_f: "YYYY-MM-DDTHH:mm:ss.SSSSZ"
_fullCalendar: true
_i: "2015-10-19T08:00:00.000-06:00"
_i is what the event was supplied with, and _d is what fullCalendar is rendering.
In every single all day event, no matter the start or end time supplied, it is always one day earlier at 18:00.
it appears that the All Day flag is setting the start and end times to 0:00:00, and then a timezone issue is pushing all those times into the previous day, but I can’t for the life of me figure out how to prevent this behaviour.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
So just to be clear:
Will ONLY show in a month view as being on the 25th. (Instead of the 25th and 26th) The solution is to instead set
end: 2015-10-27T00:00:00
? So that the 25th and 26th are included, but the 27th is not, sinceallDay
+end
works EXclusively?Your way totally makes sense. Since FC is end-exclusive, having “1 second before midnight” expect it to think it was the next day was silly, on our part. There is still one exact second until the next day. So even if it DID take time into account for
allDay: true
, our example wouldn’t work regardless.In a time-exclusive environment, settings midnight on
start
andend + 1 day
DOES make sense.E.g. to have something be the 25th and 26th, setting
end
to midnight on the 27th “works”. Exclusively, “just before midnight” would be the end of the previous included day.Once we understood the logic, it was fine.