Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I Display an event duration as a number?

Tags:

fullcalendar

I have an event with a color bar extending over 3 days. I would like a number to show how many days that color bar extends across. So, if I have a color bar thru jan 1, 2 & 3... I want a number show that says "3". representing "3 days". I assume it IS event durations?

like image 282
marce Avatar asked Feb 11 '23 00:02

marce


1 Answers

You can modify the event in 'eventRender' callback. untested but i think this would work:

$('#calendar').fullCalendar({
    // some other options,
    eventRender: function(event, element, view) {
        var duration = moment.duration(event.end - event.start).days();
        element.find('.fc-title').append(duration);
    }
});
like image 179
warath-coder Avatar answered Apr 25 '23 02:04

warath-coder