FullCalendar End Date Off By One
when I create an event, the end date of that event is always 1 after. I know there's a lot of people with this problem and their are many solutions floating around involving the use of the allDay = false
parameter. But the difference between my problem and theirs is that my calendar allows the user to input not only the date but also the time.
So I did some string manipulation like so:
var end_date = end.format("DD");
end_date = end_date - 1;
console.log("End date:" + end_date);
if(end_date == 0){
end = start;
}
else{
if (end_date < 10){
end = end.format("YYYY-MM")+"-0"+end_date;
}
else{
end = end.format("YYYY-MM")+"-"+end_date;
}
}
But this only works if the event is within the span of one day. If I create an event of three days long it will only show for two days. For example:
As you can see from the modal form, it should be 3 days long not 2. I tried and researched everywhere but could not find a solution. Any ideas?
Only Month is zero based in a javascript Date
, date and year are not. Try removing end_date = end_date - 1;
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
链接地址: http://www.djcxy.com/p/81274.html