2017-04-09 64 views
0

我使用FullCalendar 3覆蓋的開始/結束特性,我通過使用startParam & endParam像他們改變了事件屬性名稱start_at & end_at代替start & enddocs說,但它仍然不起作用。這裏是我的JS:FullCalendar無法讀取的未定義的屬性「hasTime」,即使我

<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定義,而不是start_atend_atdate財產正如我所定義的,如果我刪除它,我得到這個錯誤Uncaught TypeError: Cannot read property 'hasTime' of undefined,即使我確實這樣定義了events

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

預先感謝您。

回答

0

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

我認爲你的例子的日期時間是ISO8601不接受的。 試着改變它。

我希望它有幫助! :)

+0

感謝您的回覆,但那不是問題。 – dwix

+0

我很抱歉看到。 – LakiGeri

+0

您是否找到解決方案?我有我的事件在ISO8601字符串日期格式,我有同樣的問題... – Dante

相關問題