简体   繁体   中英

Fullcalendar week view. Display total event minutes per day in the day header

Hello please assist me with this. I have a fullcalendar developed in weekview. I have several events per day where I calculate the duration of each event using:

  var duration = moment.duration(event.end.diff(event.start));
  var mins = duration.asMinutes();
  element.find('.fc-title').append("<span class ='timeduration'>" + " " + mins + " min." + "</span>");

I would appreciate if someone could assist with showing me how I can display total of those mins per day and append to the header of the day.

So for example if this week on Wed I have 2 events showing and one is 20 mins long and another 10 mins long, I want to see total of 30 mins for that day next to Wednesday.

If Friday only has 1 event for 10 mins I want to see 10 in the header near Friday.

Thanks

I am not sure if that would work for you, but column names can be modified by using columnFormat.

Here is a link to documentation: https://fullcalendar.io/docs/text/columnFormat/

It only shows formatting for dates but you can add variables, just be careful with strings as it will parse anything that's related to date formatting.

Example:

('#calendar').fullCalendar({
          views: {
            week: { // name of view
                columnFormat: 'YYYY' + $min
                // other view-specific options here
            }
          }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM