【问题标题】:FullCalendar Cannot read property 'hasTime' of undefined, even after I override start/end propertiesFullCalendar 无法读取未定义的属性“hasTime”,即使在我覆盖开始/结束属性之后
【发布时间】:2017-09-04 20:29:30
【问题描述】:

我正在使用FullCalendar 3,我将事件属性名称更改为start_atend_at,而不是startend,就像他们在@ 中所说的那样使用startParamendParam 987654322@ 但它仍然不起作用。这是我的 JS:

<script>
        $(document).ready(function() {
            $('#calendar').fullCalendar({
                locale: 'en',
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                defaultDate: '2017-04-12',
                navLinks: true,
                editable: true,
                eventLimit: true,
                events: {
                    startParam: 'start_at',
                    endParam: 'end_at',
                    url: '/products/all',
                    color: 'yellow'
                },
                eventRender: function(event, element) {
                    element.find('.fc-title').html(event.name);
                }
            });
        });
    </script>

url 接受具有这种结构的 JSON 提要:

[
            {
                id: 1,
                name: "Product 1",
                date: "2017-04-11",
                start_at: "2017-04-09 18:58:47",
                end_at: "2017-04-09 19:58:47",
                created_at: "2017-04-09 19:13:47",
                updated_at: "2017-04-09 19:13:47",
            },
        ...
]

问题是显示事件并使用 JSON 中定义的 date 属性而不是我定义的 start_atend_at,如果我删除它,我会收到此错误 Uncaught TypeError: Cannot read property 'hasTime' of undefined,即使我确实像这样定义了events

events: {
    startParam: 'start_at',
    endParam: 'end_at',
    //...
}

提前谢谢你。

【问题讨论】:

    标签: javascript jquery laravel fullcalendar


    【解决方案1】:

    问题可能是startParamendParam 值必须是ISO8601 字符串日期格式(如文档所述)。

    我认为 ISO8601 不接受您示例的日期时间。 尝试改变它。

    希望对你有帮助! :)

    【讨论】:

    • 感谢您的回复,但这不是问题。
    • 您找到解决方案了吗?我有 ISO8601 字符串日期格式的事件,我有同样的问题......
    猜你喜欢
    • 2016-03-03
    • 2016-05-02
    • 2017-08-11
    • 2020-05-25
    • 1970-01-01
    • 1970-01-01
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多