0
Guys I’m using the Fullcalendar together with a query that has some commitments registered in a database, only that I caught a problem that I do not know how to solve
I can get Calendar to pick up bank schedules only, November schedules appear in December.
From what I could see fullCalendar has a class css calling for data-calendar-month
, in this location he defines the number of the month( month 11.12 etc).
Because he starts from 0 to counting the months has some influence?
code:
$(document).ready(function() {
/*-----------------------------------------------------
Main Calendar
------------------------------------------------------*/
if($('#calendar')[0]) {
var date = new Date ();
var m = date.getMonth ();
var y = date.getFullYear ();
var target = $ ('#calendar');
target.fullCalendar ({
header: {
right: '',
center: 'm',
left: ''
},
buttonIcons: {
prev: 'calendar__prev',
next: 'calendar__next'
},
theme: true,
selectable: true,
selectHelper: true,
editable: true,
eventLimit: 3,
contentHeight: 900,
events: [
<?php $i = 0; while($row = $calendario_todos->fetch(PDO::FETCH_ASSOC)) { ?>
{
id: <?php echo $row['id'];?>,
title: '<?php echo $row['titulo'];?> ',
start: new Date (<?php echo date('Y',strtotime($row['dtaInicio'])); ?>, <?php echo date('m',strtotime($row['dtaInicio'])); ?>,
<?php echo date('d',strtotime($row['dtaInicio'])); ?>),
allDay: true,
color: '<?php echo retornaCor(retornaDiaSemana(date('Y-m-d',strtotime($row["dtaInicio"])))); ?> ',
},
<?php $i++; } ?>
],
How are you generating the months? Could you put the code?
– Erlon Charles
because you don’t generate a
jSon
before passing this data to the plug? Your code will become easier to read and even easier to help you, because it will even be just knowing how to handle the datajSon
.– Erlon Charles
So, vlw by touch, I managed to solve here, the Calendar starts counting the months from 0 and my select brings from 1, and I passed for him to catch the month -1, at 'start'.
– JMateusBS