无法阅读财产' _calendar'在moment.js

时间:2017-09-03 19:07:46

标签: javascript laravel momentjs

当有人试图在其日历上提交要保存到服务器的活动时,我收到错误消息。感谢您的帮助,谢谢您的时间!如果您需要更多具体信息,请告诉我。

UPDATE :当我通过fullcalendar中的drop功能将事件添加到日历中时,我自己从推送切换到数组时,它似乎正常但我遇到了该代码的问题所以我使用了来自fullcalendar的clientevents而现在我收到了这个错误。关于修复可能是什么的任何想法?

我收到以下错误:

  

未捕获的TypeError:无法读取属性' _calendar' D(moment.min.js:6)的未定义在e(jquery-1.11.3.min.js:5)处于Vb   (vquery-1.11.3.min.js:5)在Vb(jquery-1.11.3.min.js:5)在Vb   (jquery-1.11.3.min.js:5)在Function.m.param   (jquery-1.11.3.min.js:5)在Function.ajax(jquery-1.11.3.min.js:5)
  在对象。 (日历:514)在Function.each   (jquery-1.11.3.min.js:2)在Object.success(日历:500)

companyCalendar.blade.php

var emailContainer = {};
                    emailContainer.email = email;
                    console.log("AJAX call here to submit dropped events as guest.");
                    $.ajax({
                        type: "POST",
                        url: '/partialAccountCheck',
                        data: emailContainer,
                        success: function (data) {
                            console.log('success, proceed with adding events to the company calendar');
                            $.each(newEvents, function (i, event) {
                                if (event.title !== 'undefined' && event.title !== null && event.title !== undefined) {
                                    console.log(JSON.stringify(event));
                                    event.start = moment(event.start).toDate();
                                    event.end = moment(event.end).toDate();
                                    event.start = formatDate(event.start) + ' ' + event.start.getHours() + ':' + event.start.getMinutes() + ':00';
                                    event.end = formatDate(event.end) + ' ' + event.end.getHours() + ':' + event.end.getMinutes() + ':00';
                                    console.log('event start is: ' + event.start);
                                    console.log('event end is: ' + event.end);
                                    event.identifier = <?php echo json_encode($companyIdentifier) ?>;
                                    event.email = email;
                                    event.services = event.title;
                                    event.startAppointmentTime = event.start;
                                    event.endAppointmentTime = event.end;
                                    console.log("AJAX call here adding dropped appointments as guest.");
                                    $.ajax({
                                        type: "POST",
                                        url: 'submitCalendarEvent',
                                        data: event,
                                        success: function (data) {
                                            console.log('success');
                                        },
                                        complete: function (data) {
                                            console.log(data);
                                        }
                                    });
                                } else {
                                    console.log('exclude from submission');
                                }
                            });
                        },
                        complete: function (data) {
                            console.log(data);
                        }
                    });

Stack Trace

2 个答案:

答案 0 :(得分:4)

我解决了为event.start和event.end创建变量的问题。

   start=moment(event.start).format('Y-MM-DD HH:mm:ss');
   end=moment(event.end).format('Y-MM-DD HH:mm:ss');
              $.ajax({
                  url:"insert.php",
                  type:"POST",
                  data:{title:event.title, start:start, end:end},

答案 1 :(得分:2)

您需要将日期从RotateRight()格式转换为RotateLeft()

date