【问题标题】:FullCalendar agendaView not showing Sunday events完整日历议程查看不显示周日活动
【发布时间】:2016-04-17 20:06:23
【问题描述】:

我有一个使用 FullCalendar v.2.6.0 的活动日历。它从一个包含 3 周每日事件的 JSON 文件中提取数据。所有事件,包括星期六事件,都显示在日程周视图中,预计星期日事件。这是我的设置

$(document).ready(function() {

    $('#calendar').fullCalendar({
        customButtons: {
        livePrograms: {
            text: 'All Live Programs',
            click: function() {
               window.location.href='https://mysite/live';
            }
        }
    },
        header: {
            left: 'title',
            right: 'livePrograms'
        },
        defaultView: 'agendaWeek',
        height: 'auto',
        allDaySlot: false,
        nowIndicator: true,
        events: {
            url: 'php/events.php',
            error: function() {
                $('#script-warning').show();
            }
        },
        loading: function(bool) {
            $('#loading').toggle(bool);
        }
    });

});

下面是我的 JSON 数据的 sn-p

[  
   {  
      "id":"51010",
      "title":"The Big Easy",
      "start":"Fri, 2016-01-01 00:00",
      "end":"Fri, 2016-01-01 02:00",
      "className":"hop",
      "url":"\/event\/41010"
   },
   {  
      "id":"91000",
      "title":"Creole",
      "start":"Fri, 2016-01-01 02:00",
      "end":"Fri, 2016-01-01 06:00",
      "className":"karma",
      "url":"\/event\/91000"
   },
   {  
      "id":"13240",
      "title":"People Presente",
      "start":"Fri, 2016-01-01 06:00",
      "end":"Fri, 2016-01-01 07:00",
      "className":"word",
      "url":"\/event\/13240"
   },
   {  
      "id":"47124",
      "title":"For Better or Worse",
      "start":"Sun, 2016-01-03 13:30",
      "end":"Sun, 2016-01-03 14:00",
      "className":"word",
      "url":"\/event\/47124"
   }
]

我尝试更改一些设置,包括在配置中添加周末:true 以及创建具有指定“持续时间:{ 天:7 }”的自定义议程视图......似乎没有任何区别。

我错过了什么?

【问题讨论】:

  • 只是添加到这一点,当我默认添加一个月视图时,然后转到议程周视图,所有事件(是的,包括星期日)都会出现。

标签: json fullcalendar


【解决方案1】:

更改 json 数据中的开始、结束日期格式。

替换

"start":"Fri, 2016-01-01 00:00",
"end":"Fri, 2016-01-01 02:00",

"start":"2016-01-01 00:00",
"end":"2016-01-01 02:00",

这会很好。

【讨论】:

  • 谢谢。我做出了改变。但我仍然对周日的任何活动一无所知
【解决方案2】:

我在最近的项目中使用了 fullcalendar。星期天我用 0 而不是 7。我认为这将解决您的问题。

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-06
相关资源
最近更新 更多