0
votes

I have a fullcalendar with defaultView "month", the content from the calendar comes from the server using json.

When fullcalendar gets the json i save the "start" date parameter to a cookie.

When a user visits the calendar page i get the value from the cookie and set fullcalendar "defaultDate" to the value of the cookie.

For example when viewing October 2018 the cookie becomes "2018-09-30", cause the "start" parameter is 2018-09-30 when viewing October.

But when i now visit the calendar page (the "defaultDate" becomes the cookie value "2018-09-30") the fullcalendar displays September. But it should display October.

How can i get fullcalendar to display October?

1
fullCalendar isn't displaying the wrong month, the problem is that you're giving it the wrong information.ADyson
I would use getDate to get the current date and put that in your cookie, rather than relying on the start of the view's range.ADyson
Cheers @ADyson ! You pointed me in the right direction. Just like the getDate function i now find the midpoint between the start and end parameter while fullcalendar retrieves the json. This midpoint is stored in the cookie and when the calendar page loads the defaultDate is set to the value of the cookie.Tinus Tate

1 Answers

1
votes

Thanks go to @ADyson for pointing me in the right direction.

I ended up storing the midpoint between the start and end date in the cookie, just like the getDate function does: https://fullcalendar.io/docs/getDate

The "defaultDate" variable then works as expected.