Home>

Nice to meet you.
I have a problem for which no solution can be found, and I would like to ask you a question.

With Fullcalendar (v5), we are developing a system that manages about 200 events a month.
I want to copy an event registered on a specific date to the next week, but when the copy is executed, a new event is registered, but it moves to the copy source event together.

Problem: The copy source event moves to the copy destination when the process is executed.

Error: None

Corresponding source code
dateClick: function (info) {
          calendar.batchRendering (function () {
            var vals = [];
            var date = info.dateStr;
            var dateSP = info.dateStr.split ('-');
            var dateJP = dateSP [1] +'month' + dateSP [2] +'day schedule';
            var events = calendar.getEvents ();
            events.forEach (function (val, i) {
              // Get events for the selected date //////////////////////////////////////
              if (val.startStr.match (date)) {
                vals.push (val);
              }
            });
            // Pop-up display when there is one or more events //////////////////////////////
            if (vals.length>= 1) {
            $.when (
              $('body'). Prepend ('<span>' + dateJP +'<span title = "close"></span></span> ') ,
              $('#popup'). css ({top: '40vh', left: '40vw'}),
              vals.forEach (function (val, i) {
                var Name = val.extendedProps.Name;
                var DateTime = val.startStr.split ('T');
                var Time = DateTime [1] .split ('+');
                $('.popupContent'). append ('<dl><dd>' + Time [0] .substr (0, 5) +'-' + Name +'</dd></dl>');
              })
            ) .done (function () {
              $('#popup'). fadeIn ();
              $('.popupContent'). append ('<span><input type = "button" value = "copy appointment to next week"></span>');
              $('# resCopy'). click (function () {
                calendar.batchRendering (function () {
                  vals.forEach (function (val, i) {
                    var dateTimeObj = val.startStr.split ('T');
                    var dateObj = dateTimeObj [0] .split ('-');
                    var timeSp = dateTimeObj [1] .split ('+');
                    var timeObj = timeSp [0] .split (':');
                    var date = new Date (parseInt (dateObj [0]), parseInt (dateObj [1]) ―― 1, parseInt (dateObj [2]) + 7, parseInt (timeObj [0]) + 9, parseInt (timeObj [1]] ));
                    var dateSp = date.toISOString (). split ('.');
                    val.setStart (dateSp [0]);// Set the date for the next week
                    calendar.addEvent ({
                     /* (Various event registration information) * /

                    });
                  });
                });
              });
            });
            }
          });
        },
What I tried

I collect various information about Fullcalendar, but I am in trouble because I can not find the information I want to know even in the official document because the information of the latest Javascript version itself is scarce because it is only the information of the JQuery version.
If i am familiar with the js version of Full calendar, please help us.

Supplementary information (FW/tool version, etc.)

FullCalendar v5
JQuery 3.5.1

  • Answer # 1

    I reviewed it once again and solved it myself.
    It was a rudimentary mistake of changing the date of the original event itself with val.setStart (dateSp [0]).
    I made a noise.

Related articles