Search code examples
fullcalendarfullcalendar-scheduler

Error displaying an event between two months


I'm having problems with the nextDayThreshold option. Even when I´m setting it to "08:00:00", FullCalendar is duplicating events that finish at "07:00:00" on the 1st of a month, displaying it with a left arrow in timelineMonth, showing the same event in two months:

Same event in two months

$(function() { // document ready

  $('#calendar').fullCalendar({
    schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
    nextDayThreshold: '08:00:00',
    header: {
      left: 'today prev,next',
      center: 'title',
      right: 'timelineMonth'
    },
    defaultView: 'timelineMonth',
    resourceColumns: [
        {
            labelText: 'first column',
            field: 'title',
            width: 150
        }
    ],
    resources: [{
      id: 'a',
      title: 'Auditorium A',
    }, {
      id: 'b',
      title: 'Auditorium B',
      eventColor: 'green'
    }, {
      id: 'c',
      title: 'Auditorium C',
      eventColor: 'orange'
    }],
    events: [{
      id: '1',
      resourceId: 'b',
      start: '2018-10-31T21:00:00',
      end: '2018-11-01T07:00:00',
      title: 'event 1'
    }]
  });

});

Fiddle

Is this a bug?


Solution

  • Short answer: No, it's not a bug.

    Long answer: The documentation for nextDayThreshold says:

    Only affects timed events that appear on whole-days. Whole-day cells occur in month view, basicDay, basicWeek and the all-day slots in the agenda views.

    In a "timeline" view, even though the slotDuration is set to 1 day by default in a "timelineMonth" view, fullCalendar still regards these as timed slots, rather than whole-day cells. Therefore the nextDayThreshold rules do not apply. e.g. If you changed to a timelineWeek view, it still uses exactly the same layout and slots, except the slots have a different length. They're not a different kind of cell.

    If we look at an updated version of your fiddle: https://jsfiddle.net/q2fk57nb/6/ which now includes a regular "month" view (I simply added right: 'timelineMonth,month' to the header) we can see that the same event in that view is confined to the 31st October, because of the nextDayThreshold rule, and the fact that the regular "month" view uses "whole-day" cells.