FullCalendar v5 dynamically set slotMaxTime and slotMinTime based on dynamic data from server
Asked Answered
E

1

6

I recently upgraded form v4 to v5 of FullCalendar. When I did this I also changed the data for my events from a static JSON object that is pulled once from the server at load to a dynamic source based on start and end dates for what the client is requesting. When I did this I lost the ability to set the slotMinTime and slotMaxTime because the start and end times could be different for each data pull. How can I dynamically set this after the request for the event data has been made?

Old v4 code:

datesSet: function () {
     calendar.setOption("slotMaxTime", data.max);
     calendar.setOption("slotMinTime", data.min);
}

Meaning when I have the data for the week of 1/10 I might have an event that starts at 9am and an event that ends at 3pm. So I'd expect my week range to start at 9am and end at 9pm. If the client then requests the week of 1/17 which has an event start at 8am and end at 1pm the week range would update to 8am and 1pm.

Enliven answered 14/1, 2021 at 22:8 Comment(0)
S
1

New functions is setOption('slotMinTime', ) setOption('slotMaxTime', )

Example (to get values from a Dropdown): calender.setOption('slotMinTime', $('#startzeit option:selected').text() + ':00');

Sphagnum answered 7/2, 2021 at 21:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.