-1

How can I highlight specific dates with time in fullCalendar's week view?

In the month view the same result can be achieved using this code:

$('.fc-day[data-date="' + date + '"]').css("background-color", "rgba(143,223,130,0.5)");

In the week view click we need to highlight selected dates.

ADyson
  • 57,178
  • 14
  • 51
  • 63
princy
  • 1

1 Answers1

0

The question is not so clear but if I get your clearly, you're trying to highlight a week using CSS in the calendar. You can try something like this. It should work.

var startDate = '2023-04-02T00:00:00';
var endDate = '2023-04-06T00:00:00';

$('#calendar').fullCalendar({
  defaultView: 'agendaWeek',
  dayRender: function(date, cell) {
    if (date.isBetween(startDate, endDate, null, '[]')) {
      $(cell).css('background-color', 'rgba(143,223,130,0.5)');
    }
  }
});
Yusuf Ganiyu
  • 842
  • 9
  • 8