在FullCalendar中隐藏开始时间

在FullCalendar上,在月视图中,有没有办法隐藏事件的开始时间?

只需添加日历选项即可

displayEventTime: false 

将以下样式添加到您的CSS

 .fc-event-time{ display : none; } 

或者在版本2+中:

 .fc-time{ display : none; } 

试试这个,它对我有用:

 $('#calendar').fullCalendar({ displayEventTime : false }); 

这应该隐藏标题事件中的开始时间。

以下内容仅在月视图中隐藏日期:

 .fc-view-month .fc-event-time{ display : none; } 

另一种方法是添加一个eventRender函数。 这样,您可以选择不渲染时间,并执行其他操作,例如将一些数据附加到事件中。

 eventRender: function(event, element) { element.find('.fc-event-title').append("
" + event.location); element.find('.fc-event-time').hide(); }

提醒CSS类名已更改为

 .fc-time { display:none; } 

如果您完全想要删除开始时间,可以使用以下代码

 $('#calendar-canvas').fullCalendar({ header: { left: 'today prev,next title', right: 'agendaDay,agendaWeek,month' }, firstDay: 1, eventRender: function(event, element) { $(element).find(".fc-event-time").remove(); } }); 

我知道你问这个问题已经有三个月了。 但是,如果你和我试图做同样的事情,那么其他人可能正在寻找答案。

在fullcalendar.js文件中,注释行1603:

 htmlEscape(formatDates(event.start, event.end, view.option('timeFormat'), options)) + 

这不是一个修复,充其量它是一个黑客,但它的工作原理。

根据http://fullcalendar.io/docs/text/timeFormat/ ,您只需要在fullCalendar设置中设置时间格式:

 $('#calendar').fullCalendar({ events: [ ], timeFormat: ' ' }); 

为了隐藏它们,以下内容应该有效

 $('#calendar').fullCalendar({ displayEventTime : false }); 

但如果你(像我一样)试图隐藏特定事件的时间,我发现它很干净。

只需创建以下CSS类并在事件属性“className”中引用它:

 .hideCalendarTime > div > span.fc-time{ display:none; } 

你的活动应该是这样的:

 var newEvent = new Object(); newEvent.title = "Something"; newEvent.start = new Date(); newEvent.allDay = false; newEvent.className = "hideCalendarTime"; 

尽管@Riz在发布时是正确的,但css在最近的版本中发生了变化,现在你需要以下内容。

 .fc-day-grid-event .fc-time{ display:none; } 
 .fc-time-grid-event.fc-short .fc-time,.fc-time-grid-event .fc-time{ display: none !important; } 

上面的代码将在所有视图中更正它。

下面的代码有一个流程,可以在大事件视图中显示时间

  .fc-time-grid-event.fc-short .fc-time{ display: none !important; } 

请在css中使用此代码来隐藏仅来自事件的时间。

使用只是

 .fc-time{ display: none !important; } 

还会隐藏左侧网格的时间。

只需从fullCalendar函数中删除allDay: false,即可