Dear, I have a big problem. I am making a time reservation system, therefore I am using fullcalendar.io
a fairly complete library.
What I need to do is: How to color a light green or transparent green, certain times of the week on a regular basis. As if to show that those hours are available.
For that I added an event but in fullcalendar it does not support periodic events (repeating every Monday). I need to only color the available hours with a start time, end time and the day of the week.
Is it possible to do that?
$('#calendario').fullCalendar({
defaultView: 'agendaWeek',
allDaySlot: false,
header: {
left: 'prev,next today myCustomButton',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
dayClick: function(date, jsEvent, view) {
//alert('Clicked on: ' + date.format());
$("#hora_seleccionada").html(date.format("MM/DD/YYYY, h:mm:ss"));
}
});
Fullcalendar has a similar feature built in, but it works the other way around what you want. That is, it colors the non-working hours.
The businessHours property sets the time range and days of the week that you want to highlight differently (non-business hours).
This does not create fullcalendar events, it is just to show which hours are working and which are not.
To change the colors, you must modify the style
.fc-nonbusiness
for non-working daysUnfortunately, it only allows you to configure the same pattern for each day of the week that is working.
This must be added to the fullcalendar initialization:
Full example:
I found a new way to this solution: Although businessHours works I had another problem which was to add an array of businessHours and it also works in the opposite way as my problem was stipulated.
I found this issue on main Stack Overflow: https://stackoverflow.com/questions/30977505/how-to-add-multiple-business-hours-in-fullcalendar
What I did was add a light green event with opacity:
Thanks @rnrneverdies for clarifying my doubts