Calendar doesn't show 24 hour event.

Events with exact 24 hours for example start = 12.05.2015 00:00:00 and end = 13.05.2015 00:00:00 will not be shown in my test calendar as soon as I use calendar.setFirstVisibleHourOfDay(8). Please see the example below:

final Calendar cal = new Calendar();

BasicEvent myEvent = new BasicEvent();
myEvent.setCaption(“24 Hour Event”);

Date startDate = DateUtils.parseDate(“11.05.2015 00:00:00”, “dd.MM.yyyy HH:mm:ss”);
Date endDate = DateUtils.parseDate(“12.05.2015 00:00:00”, “dd.MM.yyyy HH:mm:ss”);

cal.setFirstVisibleHourOfDay(8); //without this line the event will be displayed
[/code]Furthermore if I set end to 12.05.2015 00:00:01 the event is displayed even with cal.setFirstVisibleHourOfDay(8).
For me this seems to be a bug. What do you think?

Please help if you can?
thank you.

, do you think it could be the same problem? It’s actually been fixed, twice, but the last review has been stuck in review for 6 months now… I’ll try to kick somebody about it, as reviews should have a priority.

If I remember correctly, an event is an all-day event if it starts and ends exactly at 00:00:00, but if it’s even a second longer, then it’s considered either a multi-day event or an ordinary one…I’m not immediately sure which.

Hi Marko

Thanks for your reply, yes it could be the same problem. Furthermore I have to tell you if I set


then the event is displayed as an all day event but not only on 11.05 also on 12.05. In fact the event is only 24 hours and should not be displayed on a second day.

Ah yes, I remembered a bit wrong how that works. It seems that if the allDay is set true, all days in the range are considered as all-day days if the range covers the midnights when the days start; that is, also if the range ends at 00:00:00 on the second day. You can notice that in
this basic example

And indeed, it looks like if the event is exactly 1 day, from 00:00:00 to 00:00:00 next day, the entire event vanishes. If it’s just one second longer or shorter, it works OK. Well, if it’s just one second longer, there’s a small stub visible next morning even if the visibility start time is later, and I’m not sure if that is quite appropriate. Anyhow, this is maybe a different problem than the one in the ticket, as this occurs when the allDay is set as true.

Thanks again Marko for your information.

What shall I do now with my orginal problem. I don’t like the idea to append or to shorten all my day events coming from the db for one second, only that the events will be displayed corretly. At the moment I omit the method call cal.setFirstVisibleHourOfDay(8) for developing. Unfortunately as soon as the project goes live I need setFirstVisibleHourOfDay because nobody will be interestedin the night hours.

Do you think ticket #14737 is enough or do I have to open a new issue?

There’s a strong possibility that #14737 is about the same problem, so we’ll just have to wait that the fix is reviewed and merged. I can’t say how long it will take; the guys are working on the review queue, so they’ll get to that eventually.

I don’t know how you are feeding the calendar with your events, but there might not be a better workaround than to shorten the events by one second. I hope you can do it so that the workaround doesn’t affect the database.