let's say I am creating event From Date : 2017-06-14 To Date: 2017-06-16 From Time : 13:00:00 To Time : 16:00:00
I am storing in these in database correctly. Now an issue is in full calendar data should be display between time 13:00:00 to 16:00:00 instead it is displaying for a full day on 2017-06-15. Any Mistake? My Code is
Full Calendar Displaying Data:
var id=$("#hidden_id").val();
$('#calendar').fullCalendar({
defaultView: 'agendaWeek',
header: {
left: '',
center: 'prev title next',
right: ''
},
/*
loading: function (bool) {
$("#loading_div").show();
},
*/
defaultDate: "<?php echo date('Y-m-d');?>",
navLinks: true, // can click day/week names to navigate views
editable: false,
events: "json_rate-info/"+id,
allDay: true,
selectable: true,
selectHelper: true,
});
Fetching Data Function
public function GetJsonRateInfo($rate_id)
{
$json = array();
$start=$_REQUEST['start'];
$end=$_REQUEST['end'];
if($start != '' && $end != '')
{
$where="(from_date BETWEEN '$start' and '$end') or (to_date BETWEEN '$start' and '$end')";
$finalArray=[];
$json=$this->Rates_model->getAnyData($where);
/*echo '<pre>';
print_r($json);
die();*/
if(!empty($json))
{
foreach ($json as $key => $js) {
$finalArray[$key]['id']= $js->id;
$finalArray[$key]['start']= date('Y-m-d',strtotime($js->from_date))."T".$js->from_time;
$finalArray[$key]['end'] = date('Y-m-d',strtotime($js->to_date))."T".$js->to_time;
if(!empty($js->rate_per_hour) && !empty($js->rate_per_mile))
{
$fullTitle="Per Hour: ".$js->rate_per_hour.",Per Mile: ".$js->rate_per_mile;
}
elseif(!empty($js->rate_per_hour) && empty($js->rate_per_mile)){
$fullTitle="Per Hour: ".$js->rate_per_hour;
}
elseif(empty($js->rate_per_hour) && !empty($js->rate_per_mile)){
$fullTitle="Per Mile: ".$js->rate_per_mile;
}
$finalArray[$key]['title']=$fullTitle;
}
echo json_encode($finalArray);
}
}
}
My Json Data :
[{"id":"1","start":"2017-06-14T13:00:00","end":"2017-06-15T16:00:00","title":"Per Hour: 11.00,Per Mile: 11.00"}]
allDay: true
is not a valid option in the calendar initialisation, check the documentation. Not sure what your intention was by setting that? – ADyson[{"id":"1","start":"2017-06-14T13:00:00","end":"2017-06-14T16:00:00","title":"Per Hour: 11.00,Per Mile: 11.00"}, {"id":"2","start":"2017-06-15T13:00:00","end":"2017-06-15T16:00:00","title":"Per Hour: 11.00,Per Mile: 11.00"}, {"id":"3","start":"2017-06-16T13:00:00","end":"2017-06-16T16:00:00","title":"Per Hour: 11.00,Per Mile: 11.00"}]
– ADyson