简体   繁体   English

全日历周视图。 在日标题中显示每天的事件总分钟数

[英]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. 因此,例如,如果本周星期三我有2个活动显示,一个活动时间为20分钟,另一个活动时间为10分钟,那么我想在周三隔天看到总共30分钟。

If Friday only has 1 event for 10 mins I want to see 10 in the header near Friday. 如果星期五在10分钟内只有1个事件,我想在星期五附近的标题中看到10个事件。

Thanks 谢谢

I am not sure if that would work for you, but column names can be modified by using columnFormat. 我不确定这是否适合您,但是可以使用columnFormat修改列名。

Here is a link to documentation: https://fullcalendar.io/docs/text/columnFormat/ 这是文档的链接: 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
            }
          }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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