【问题标题】:Tweaking for fullcalendar axis time format and hide event time调整全日历轴时间格式并隐藏事件时间
【发布时间】:2013-08-12 08:34:24
【问题描述】:

我想在 fullcalendar 中应用这两个更改:

  1. 轴时间格式如:10:00-11:00、11:00-12:00、12:00-13:00...等。

  2. 隐藏事件时间只显示事件名称

检查快照

我申请轴格式的代码:

jQuery('#fullcal').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },

    timeFormat: 'H:mm{-H:mmtt }',
    axisFormat: 'H:mm - H:mm',

  events: [
    {
      title: "<?php echo "Booked"; ?>",
      start: new Date(<?php echo "$date, $start"; ?>),
      end: new Date(<?php echo "$date, $end"; ?>),
      allDay: false,
      backgroundColor : "#1FCB4A",
      textColor: "black",
    },
  ],

});

代码axisFormat: 'H:mm - H:mm',同时重复。

在事件11:00 - Test 中,我只想显示事件名称Test,如果我评论start:end:,这将使全日历上的事件消失。

请帮我在完整日历中添加此更改。谢谢。

【问题讨论】:

  • 我找到了用于调整事件时间的 CSS:.fc-event-time { display: none; },现在需要帮助来修改轴时间格式。

标签: fullcalendar time-format


【解决方案1】:

FullCalendar 不支持 axisFormat 中的结束时间,但通过对 FullCalendar 源代码进行一些小的更改,它成为可能。我在这里为类似问题提供了解决方案:https://stackoverflow.com/a/17547384/198065

您可以通过设置timeFormat: '' 来隐藏事件中的时间。

【讨论】:

【解决方案2】:

FullCalendar 确实支持axisFormat 中的结束时间。 只需尝试以下代码即可查看上午 10:00 - 10:45、上午 11:00 - 11:45 等。

axisFormat: 'h:mm tt - h:45 tt',

timeFormat: {
    agenda: 'h:mm{ - h:mm}'
},

【讨论】:

    猜你喜欢
    • 2013-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多