Reputation: 15156
Basically I would like to show today as the first day of the week in a week view of Fullcalendar js. I have tried to find the right method in the docs without luck. However, abusing firstDay
with firstDay: 19
for today (2015-04-24) I could achieve this (week starting today):
Since this cannot be the correct way, I would like to know a correct solution here. I tried defaultDate and gotoDate, but they did not work.
Upvotes: 1
Views: 2512
Reputation: 15156
To set the current day as beginning of week use firstDay: (new Date().getDay()),
.
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaWeek'
},
defaultDate: '2015-04-25', // is not setting the Friday to first day in weekview
editable: false,
defaultView: 'agendaWeek',
firstDay: (new Date().getDay()), // returns the day number of the week, works!
timeFormat: 'HH:mm',
lang: 'de',
columnFormat: 'dddd D.M.',
allDaySlot: false,
slotDuration: '00:30:00', // default is 30 min
minTime: '12:00:00',
maxTime: '23:00:00',
contentHeight: 600,
events: [
{
title: 'Test',
start: '2015-04-25T14:00:00',
end: '2015-04-25T21:00:00',
dow: [4], // repeat same weekday
rendering: 'background',
color: '#6BA5C2'
},
],
timezone: 'local',
// ...
}); // end fullCalendar
Upvotes: 2