본문 바로가기
JavaScript

[JavaScript] FullCalendar 종료일 관련 이슈

by palbokdev 2021. 6. 8.
{
     id: 31,
     title: 'Test',
     start: '2014-12-22',
     end: '2014-12-23',
     allDay: true
}

이벤트를 위와 같이 표시했을때, 종료일이 하루 적게 표기되는 현상이 있다.

 

eventDataTransform: function(event) {                                                                                                                                
  if(event.allDay) {                                                                                                                                               
    event.end = moment(event.end).add(1, 'days')                                                                                                                 
  }
  return event;  
}   

이벤트를 변환할때 하루 더 길게 그리도록 하고, 이벤트를 변경할때 (eventResize, eventDrop등) 하루를 빼서 (subtract) 적용시킨다.

 

ref : https://stackoverflow.com/questions/27604359/fullcalendar-event-spanning-all-day-are-one-day-too-short