簡體   English   中英

FullCalendar即使我覆蓋了開始/結束屬性,也無法讀取未定義的屬性“ hasTime”

[英]FullCalendar Cannot read property 'hasTime' of undefined, even after I override start/end properties

我使用FullCalendar 3 ,我改變了事件屬性名稱start_atend_at而不是startend使用startParamendParam就像他們在上述文件 ,但它仍然不起作用。 這是我的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",
            },
        ...
]

問題是,這些事件顯示和使用date的JSON,而不是定義的屬性start_atend_at為我所定義的,如果我刪除它,我得到這個錯誤Uncaught TypeError: Cannot read property 'hasTime' of undefined ,即使我做了定義這樣的events

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

先感謝您。

問題可能是startParamendParam值必須為ISO8601字符串日期格式 (如文檔所述)。

我認為您的示例的日期時間不被ISO8601接受。 嘗試更改它。

希望對您有所幫助! :)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM