coler-j
coler-j

Reputation: 2109

FullCalendar week view start on Monday

I want to do something similar to this: show only weekdays, however, I would like it to start on the first day of the week (or show from Sunday to the next Saturday).

I have tried setting a moment for the start and intervalStart option of the first day of the week (i.e. Sunday) but this doesn't seem to work.

Edit (from link above):

$('#calendar').fullCalendar({
    header: {
        left: '',
        center: '',
        right: '',
    },
    editable: true,
    views: {
        settimana: {
            type: 'agendaWeek',
            duration: {
                days: 7
            },
            title: 'Apertura',
            columnFormat: 'dddd', // Format the day to only show like 'Monday'
            hiddenDays: [0, 6] // Hide Sunday and Saturday?
        }
    },
    defaultView: 'settimana',
    });

Upvotes: 4

Views: 7008

Answers (3)

You can add firstDay: 1.

$('#calendar').fullCalendar({
  firstDay: 1,
})

or

let calendar = new FullCalendar.Calendar(calendarEl, {
 firstDay: 1,
 ...
});

Upvotes: 1

Dart Dega
Dart Dega

Reputation: 250

For future reference, for custom views the dateAlignment option can be used to implement something like weekdaysOnlyView.

Upvotes: 2

coler-j
coler-j

Reputation: 2109

I was able to do this with:

$('#calendar').fullCalendar({
    ...  
    // Added the default date
    defaultDate: $.fullCalendar.moment().startOf('week'),
    ...
    });

Upvotes: 1

Related Questions