Note that there are some explanatory texts on larger screens.

plurals
  1. POproblems inserting individual new events from a selected range of dates
    text
    copied!<p>I am using the GREAT jquery plugin fullcalendar.</p> <p>Here is my problem.</p> <p>When a user selects a range of dates by click and dragging over 2 or 3 consecutive dates on the calendar. For example from the 3rd to the 5th of any given month.</p> <p>The select: function (start, end, allDay) event fires with the start date of 3rd of that month and end date of 5th of that month.</p> <p>What I want to do is insert an individual event for each one of the dates. So I DO NOT want to insert 1 long event lasting 3 days... I want to insert individual events for each one of those days.</p> <p>Here is the code I use:</p> <pre><code>select: function (start, end, allDay) { var title = 'test';// prompt('Event Title:'); while (start.valueOf() &lt; end.valueOf() + 86400000) { calendar.fullCalendar('renderEvent', { title: title, start: start, allDay: allDay }, true // make the event "stick" ); start.setTime(start.valueOf() + 86400000); } calendar.fullCalendar('unselect'); }, </code></pre> <p>But every time it inserts a new event it then moves up the last inserted event by 1 day. So at the end all 3 events I am creating will end up being created on the 5th. The 5th will 3 events. When I put breaks in my code I can actually see the events being created at the proper date, but when it goes to the next date (from the 3rd to the 4th) then the last inserted date (the 3rd of the month) gets bumped also to the 4th.</p> <p>Same thing happens with that code if I select only 1 date at a time. </p> <p>Say I select the 3rd of January. The event gets created on the 3rd of January. But then if I go click on the 15th of January, that event gets created on the 15th, then the last created event on the 3rd gets bumped to the 4th of January.</p> <p>Then if I click and selct the 6th of January, the event gets created correctly on the 6th, but the last event, the 15th gets bumped to the 16th... please help</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload