Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery full calendar displays events next day
    primarykey
    data
    text
    <p>I'm trying to integrate the jquery calendar plugin into my custom cms,</p> <p>My issue is that events are shown the next day that the original value (in database) is set.</p> <p>This is how i am retrieving my events:</p> <pre><code>$query = "SELECT id,avatar, titulo AS title,texto as name, unix_timestamp(start_date) as start,unix_timestamp(end_date) as end, start_date, end_date FROM blogs WHERE (unix_timestamp(start_date) &gt;= '$start' OR unix_timestamp(end_date) &lt;= '$end') AND post_type = 'event' AND lan = '$lan'"; //echo $query; $year = date('Y'); $month = date('m'); $result = mysql_query($query); $array = array(); $i = 0; while ($row = mysql_fetch_array($result)) { $raw = $row; $raw['url'] = '/blog/'.urls_amigables($raw['title']).'/'.$raw['id'].'/'; $raw['start_show'] = prettyDateTime($raw['start_date']); $raw['end_show'] = prettyDateTime($raw['end_date']); $array[$i] = $raw; $i++; } echo json_encode($array); </code></pre> <p>And this is how i am showing them into the <a href="http://arshaw.com/fullcalendar/">jquery calendar</a>:</p> <pre><code>$('#calendario').fullCalendar({ events: "/includes/json-events.php", eventDrop: function(event, delta) { alert(event.title + ' was moved ' + delta + ' days\n' + '(should probably update your database)'); }, loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); }, eventMouseover: function( event, jsEvent, view ) { var item = $(this); var image = ''; if(event.avatar != '') image = '&lt;img src="'+event.avatar+'" /&gt;'; if(item.find('.nube').length == 0){ var info = '&lt;span class="nube"&gt;&lt;h2&gt;'+event.title+'&lt;/h2&gt;'+image+' &lt;p class="text"&gt;'+event.name+'&lt;/p&gt;&lt;p&gt;'+event.start_show+' &lt;br /&gt; '+event.end_show+'&lt;/p&gt;&lt;p&gt;&lt;a href="'+event.url+'"&gt;read_more&lt;/a&gt;&lt;/p&gt;&lt;/span&gt;'; item.append(info); } if(parseInt(item.css('top')) &lt;= 200){ item.find('.nube').css({'top': 20,'bottom':'auto'}); item.parent().find('.fc-event').addClass('z0'); } if(parseInt(item.css('left')) &gt; 500){ item.find('.nube').css({'right': 0,'left':'auto'}); item.parent().find('.fc-event').addClass('z0'); } item.find('.nube').stop(true,true).fadeIn(); console.log(parseInt(item.css('left'))); }, eventMouseout: function( event, jsEvent, view ) { var item = $(this); item.find('.nube').stop(true,true).fadeOut(); }, header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, eventRender: function(event, element) { } }); </code></pre> <p>The problem here is that <code>unix_timestamp(start_date)</code> would generate the next day in the calendar</p> <p>(ex: if is stored the start_date in day 17 of the month, in the calendar will appear in the day 18th)</p> <p>and I'm not sure what i've missed. All this i made it by following their specs...</p> <p>Any idea where am i failing? (jquery, mysql or timezone settings?)</p> <p>-EDIT-</p> <p>I kind of fixed it by</p> <pre><code>$row['start'] = $row['start'] - 60*60*24 /* One day */; </code></pre> <p>So now <code>start_date</code> and <code>start</code> make sense together (IN the calendar...)</p> <p>Please tell me you know a better solution!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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