skip to Main Content

What’s the problem in my code?

Cannot read properties of undefined (reading ‘formatDate’)

 editable:true,
    eventResize:function(event)
    {
    console.log(event.start);
    
     var start = $.fullCalendar.formatDate(event.start, "YYYY-MM-DD HH:mm:ss");
     var end = $.fullCalendar.formatDate(event.end, "YYYY-MM-DD HH:mm:ss");
     var title = event.title;
     var id = event.id;
     $.ajax({
      url:"../Components/calendar/update.php",
      type:"POST",
      data:{title:title, start:start, end:end, id:id},
      success:function(){
       calendar.fullCalendar('refetchEvents');
       alert('Event Update');
      }
     })
    }

Console.log of event.start

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    this is old version

    $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");
    

    Solution:

    moment(event.start, 'DD.MM.YYYY').format('YYYY-MM-DD HH:mm:ss')
    

  2. When You select the start and end date on full calendar use following code as well:

    select: function(start, end) {
                      
         var start_date = moment(start).format('YYYY-MM-DD HH:mm:ss'));
         var end_date = moment(end).format('YYYY-MM-DD HH:mm:ss'));
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search