maddhatter / laravel-fullcalendar

Laravel FullCalendar.io Helper
627 stars 266 forks source link

Support for recurrent events (solution) #77

Open guillermobt opened 7 years ago

guillermobt commented 7 years ago

I've been having trouble when working with recurring events because in the "agenda" views, they were not showing up scheduled in the proper start time.

I managed to solve it adding the following code in the EventCollection.php class, after the $eventArray definition:

/* On recurring events, fullcalendar requires the start and end values to just contain the time (hour:minutes) part of the date */

if ($vOptions = $event->getEventOptions())  {
    if (isset($vOptions ['ranges']) || isset($vOptions ['dow'])) {
        $eventArray['start'] = $event->getStart()->format('H:i');
        $eventArray['end'] = $event->getEnd()->format('H:i');
    }
}
guillermobt commented 6 years ago

@maddhatter : Please, consider merging pull-request #83 in order to fix this bug.

I attached some screenshots in the pull-request comments so you can see what I'm talking about.

ShapesGraphicStudio commented 5 years ago

Hi, Sorry for reactivating an old thread, but I'm looking to integrate recurring events too. I can't see daysOfWeek option in this bundle.

I need to create events based on courses created in database with: day of week (number -> 1 for Monday) start hour start minute duration

All events should repeat weekly.

I found a workaround by setting a static start date and adding weeks with a foreach loop, but that solution is ugly and will bring issues on year change.

I can see your commit has not been merged. How come ? Any idea on how I could get my job done please ?

ShapesGraphicStudio commented 5 years ago

Hi again,

I was looking for daysOfWeek, but as it uses FullCalendar V2, I had to take a look at dow in the options array.

Thanks to your great commit, it works fine now !