Search code examples
javascriptjqueryfullcalendarfullcalendar-scheduler

How to rechange firstDay properties in FullCalendar by jquery


I want to rechange value of firstDay properties of FullCalendar by jquery when i change view mode month -> week.

Initial

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

Change To

$('#calendar').fullCalendar({ firstDay: moment().weekday() })

But it's not work.

I think it's code will place inside viewRender function, but i don't know how do that?.

Please help me, thanks all so much.


Solution

  • You should be able to change the firstDay option after initialization like this

    $('#calendar').fullCalendar('option', 'firstDay', moment().weekday());
    

    This requires version 2.9.0 or higher.

    This is the docs page describing the getters and setters for calendar options https://fullcalendar.io/docs/utilities/dynamic_options/