2014-09-05 2 views
2

fullcalendar와 함께 moment(). format()을 사용하려고합니다. 나는 달력에서 요소를 드래그하면이 오류가moment(). format() 및 fullcalendar : undefined가 함수가 아닙니다.

<script src="<?php echo ASSETS_URL; ?>/js/plugin/fullcalendar/lib/moment.js"></script> 
<script> moment().format() </script> 
<script type="text/javascript"> 
$('#calendar').fullCalendar({ 

     header: hdr, 
     buttonText: { 
      prev: '<i class="fa fa-chevron-left"></i>', 
      next: '<i class="fa fa-chevron-right"></i>' 
     }, 
     defaultView: "agendaWeek", 
     editable: true, 
     droppable: false, // this allows things to be dropped onto the calendar !!! 
     lang: 'it', 
     timeFormat: 'H(:mm)', 
     firstDay: 1, 
     drop: function (date, allDay) { // this function is called when something is dropped 


     events: [{ 

     }], 
     eventDragStart: function(event, jsEvent, ui, view) { 
      ev_start=event.start.moment().format("dddd (d) DDD - D/MM/YY"); 
      console.log(ev_start); 
      }, 

     }, 

: catch되지 않은 형식 오류 :이 코드가 정의되지 않은 함수가되지

좀 디버그를 수행하고 오류가 순간에 의해 발생

() .format() 누구든지 도와 드릴 수 있습니까?

+0

당신의 모든 라인이 필요하지 않습니다.

+0

또한 라인이 없으면 오류가 있습니다. – Joe

+0

lib를 제거하고이 CDN을 사용하십시오.

답변

6

해당 줄에서 오류가 발생하면 moment.js 파일이 양호한 지 확인하십시오.

그런 다음,이 라인은 잘못된 것입니다 : 당신이이 작업을 수행해야 timedate

ev_start=event.start.moment().format("dddd (d) DDD - D/MM/YY"); 

event.start 경우

ev_start = moment(event.start).format("dddd (d) DDD - D/MM/YY"); 
+0

괜찮습니다. 이 sintax를 사용하여 문제를 해결했습니다. Michele 대단히 감사합니다 :) – Joe

+0

다행 이네, 반가워요. –

관련 문제