mattlewis92/angular-bootstrap-calendar

Event cannot start after it finishes

Ederagp opened this issue · 4 comments

Bootstrap calendar: Event cannot start after it finishes

to generate the problem of recurring events, in this case I have 2 events with rrule (Use the rrule library to generate recurring events: https://github.com/jkbrzt/rrule).

The first event is generated every Wednesday and the second event every Monday and Friday.

If we see the day view for the second event we observe that it is there, BUT IF WE GIVE IN THE FIRST EVENT IN THE DAY VIEW DO NOT APPEAR !!!
and in the browser console shows the warning

I DO NOT SEE THE ERROR OR THE PROBLEM WHY NOT CHARGE IT IN THE VIEW OF THE DAY

Thanks for the help

Link Plunker - http://plnkr.co/edit/oJwDEMcCXszQtWkFdNFY?p=preview

problem is reproduced in the link.
if the console is observed the problem appears.

Versions

Angular: 1.5.8

Calendar library: angular-bootstrap-calendar release 0.30.0

Browser name and version: Google Chrome version 61.0.3163

@Ederagp I'm following up here because you mentioned this issue on Gitter and I'd like to help if I can. I am not a maintainer of this project, but I follow the channel because I used it once-upon-a-time and like to use the understanding I gained of the project be using it to help others.

I think the warning is pretty explanatory. Events can't end before they start. In the case of this library, it uses the start and end to position elements on the calendar view, and if they end before they start, it probably ends up with negative height calculations.

You ask, Why not change the start and end date if they're wrong?

As a library author myself, I wouldn't change people's input values either. It leads to bugs that are hard to track down because the library is handling your mistake by fixing it, instead of showing you that you made a mistake. In angular, if you mutate the input value and it is being watched, it can also lead to unwanted extra digest cycles which hurt performance. If the library changed them, and then you changed them back for some reason, it could even end up as an infinite digest loop.

Your best course of action would be to correct your code so that events do not end before they start. This is not a bug.

@nbering Thank you for helping.

How could you know that an event does not end before you start?
in the plunker example the events are correct and I can not visualize the detail

Error Output

This warning from your plunker example shows that the event starts at 9am and ends at 1am of the same date. The end time is 8 hours before the start time.

Great, I've modified the time format and it works perfect.

thank you very much @nbering