Problem/Motivation

Events that go past midnight span two days on the calendar

Proposed resolution

FullCalendar has a nextDayThreshold setting that provides leeway for events that run past midnight. See:

https://fullcalendar.io/docs/nextDayThreshold

A user setting would be nice, but in the meantime, is there a way to manually modify the code to set this? Thanks for the module and thanks in advance for any help!

Comments

bcobin created an issue. See original summary.

mingsong’s picture

That is weird.

I am not sure what exactly happen to your site. It could be a bug.

Regarding adding a custom setting to the view, there are two ways.

1. Backend via overwriting FullcalendarViewProcessorBase classe.
Example see
https://www.drupal.org/project/fullcalendar_view/issues/3207988#comment-...

2. Frontend via custom JS.
Example see
https://www.drupal.org/project/fullcalendar_view/issues/3243435#comment-...

bcobin’s picture

Thanks for the quick response - much appreciated! I'm trying to reproduce in Drupal 9 what I've done here:

https://kgbbar.com/events

The one difference would be to have end times past midnight not make the event span two days on the calendar. (Google Events likes to see beginning and end times.)

I'm using Smart Date and changing the settings in the FullCalendar display seems to have no effect at all - I just get the Start time and the title, no matter what the settings are. Even adding separate start and end fields and choosing them in the interface makes no difference.

I think this should be a fairly common use case - any ideas would be a big help! Thanks in advance and for the module...

bcobin’s picture

I've added the below in fullcalendar_view.js and it works a treat, both to display the end date and to set the next day threshold to 9 AM the next morning.. success!

// Update the Full Calendar calendar options for the Calendars View and set day threshold to 9 AM.
  if (drupalSettings.fullCalendarView !== undefined && drupalSettings.fullCalendarView[0]['calendar_options'] !== undefined) {
  let calendarOptions = JSON.parse(drupalSettings.fullCalendarView[0]['calendar_options']);
  // Ensure that the end date is always displayed.
  calendarOptions['displayEventEnd'] = true;
  calendarOptions['nextDayThreshold'] = '09:00:00';
  drupalSettings.fullCalendarView[0]['calendar_options'] = JSON.stringify(calendarOptions);
  }

Thank you gcalex from here!

I'm still wrestling with Drupal 9, though, and haven't been able to figure out how to inject JS in the theme. Obviously, modifying the js is totally wrong, but at least a solution is in sight here - any guidance on adding js is most welcome!

mingsong’s picture

Status: Active » Closed (outdated)