acidb / mobiscroll

Cross platform UI controls for progressive web and hybrid apps (plain JS, jQuery, Angular and React)
https://mobiscroll.com
Other
1.54k stars 439 forks source link

Customize behavior of multi-day events #464

Closed ot-dtd closed 5 years ago

ot-dtd commented 5 years ago

In the Event Calendar with labels enabled and when an event crosses midnight, it stretches the label across both days. It would be useful to set an option that determines whether the event shows on the first day only, the label gets split in two, or the current behavior occurs.

There is a partial work around for the first case, which is to set the end time of the event to midnight if it crosses, but this changes the duration of the event which shows up in the event bubble.

As well, it appears that events crossing midnight are also marked as All Day events, even if that is explicitly set in the event to be false.

An example use case for this change is an overnight shift beginning at 10pm on the 1st and ending at 2am on the 2nd. I wouldn't expect to see this event stretch over both days, and I wouldn't expect it to be labeled an All Day event. I'd like to see the start time of 10PM and the duration of 4 hours. Applying the workaround above would show 2 hours duration.

dioslaska commented 5 years ago

In 4.6.3 we fixed the issue with multi day events always marked as all-day, Regarding the rest: events crossing midnight will still span over the next day. Now that the event is passed to the formatDuration function, the solution would be to leave the end time on the same day, and pass the cross midnight time in a custom property of the event object. You can pass a custom formatDuration function which can use the custom poperty from the event object to calculate the duration.

ot-dtd commented 5 years ago

Excellent. Thank you!