0
I created an agenda with using Full Calendar, it displays the events, but does not respect the end date, always ends the event a day before, but only in the display. I don’t know if that field Duration is being respected, but should respect the field end. Below is the code that makes the search and mounts the json:
$conexao = new PDO('', '', '');
if(!$conexao){
echo "<script> window.location.replace('../erro.html'); </script>";
}
$consulta = $conexao->query("SELECT id, title, start, end, datediff(ADDDATE( end, INTERVAL 1 DAY), start) as duration FROM eventos");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) {
$vetor[] = $linha;
}
//Passando vetor em forma de json
echo json_encode($vetor);
Thanks if anyone has any suggestions how to solve.
js:
<script>
$(document).ready(function() {
//CARREGA CALENDÁRIO E EVENTOS DO BANCO
$('#calendario').fullCalendar({
header: {
right: 'prev,next',
center: 'title',
left: 'month,agendaWeek,agendaDay'
},
//defaultDate: '2016-01-12',
editable: true,
eventLimit: true,
events: 'eventos.php',
eventColor: '#0277BD'
});
});
</script>
In json the returned data respects the end date?
– Jessika
Yes, the data is correct, but when displaying does not work, always ends a day before. The start date is ok, only so that it does not respect. I tried to use the field the field
duration
, but he also doesn’t respect.– R.Gasparin
In your select you cannot use the
Between
to pick up information between the two dates?– R.Santos
Is there any way you can put the js q snippet generates fullcalendar? If json is correct the error is in js.
– Jessika
Could you put the JSON that PHP generates so we can replicate your code?
– Woss