Alvykun
Alvykun

Reputation: 173

Using month view, move week by week instead of month by month

I am using FullCalendar v2.2.5 and I would like to navigate week by week instead of month by month when the calendar is using the month view.

I see that the function used to navigate forward is this but I wasn't able to figure a way to change this behaviour.

Is there any way to accomplish this?

Upvotes: 2

Views: 443

Answers (1)

Luís Cruz
Luís Cruz

Reputation: 14970

By default, as stated on prev and next documentation:

If the calendar is in month view, will move the calendar back/forward one month.

If the calendar is in basicWeek or agendaWeek, will move the calendar back/forward one week.

If the calendar is in basicDay or agendaDay, will move the calendar back/forward one day.

If you want to change the how that works, you'll need to use a Custom view, based on the month view. Something like:

$('#calendar').fullCalendar({
    defaultView: 'customMonth',
    views: {
        customMonth: {
            type: 'month',
            duration: {weeks: 1}
        }
    }
});
    

Basically, you "create" a customMonth view (which is the default view), based on the month view and the duration of this is one week. I've made a jsfiddle where you can see this working.

Full disclosure: This solution was found based on this answer.

Upvotes: 1

Related Questions