Reputation: 1521
I have a fullcalendar, and I'm able to enter event's in it. But, when I enter events, without a time, they appear to end one day earlier, so when I have the end-date of 2015-09-05, it ends on the 4th. of September, not on the 5th... I think it's because it's "the end", so on that day, it's over, so it ends one day before, but I don't want that behaviour, I want to have it shown, like the day you provide for the end is still in the time the event "runs". The interesting thing is, that if I provide a time (like 2015-09-05T14:00:00), it works, because it definetely ends on the provided day.
The question now is: How can I change this behaviour, so the event is displayed with the right time?
edit: the problem is really, that the day you provide, is exclusive, so it's not in the time any more.
end :The exclusive date/time an event ends. Optional.
The question is, how can I change this behaviour...
edit2 I tried something like
var end_split = enddate.split('-');
end_split[2]= parseInt(end_split[2])+parseInt("1");
enddate = end_split[0] + "-" + end_split[1] + "-" + end_split[2];
this now, and it works in general, but has issues, if enddate is the 30th of a month, because then the end date saved will be the 31th, and this doesn't exist always...., so this solution won't work...
Upvotes: 2
Views: 2595
Reputation: 1023
I was also facing the same and resolved it by adding "T23:59:00" with the end date PHP code:
$data_events[] = array(
"id" => $eventid,
"title" => $title,
"start" => $start_date,
"end" => $end_date."T23:59:00"
);
echo json_encode(array("events" => $data_events));
Upvotes: 1
Reputation:
The answer is simple if we follow the following steps
milliseconds = Date.parse(enddate);
var d = new Date(milliseconds);
Upvotes: 3