I have the ajax code below for the calendar:
$.ajax({
url: 'display_event.php',
dataType: 'json',
success: function (response) {
var result=response.data;
$.each(result, function (i, item) {
events.push({
event_id: result[i].event_id,
title: result[i].title,
start: result[i].start,
end: result[i].end,
//color: result[i].color,
url: result[i].url
});
})
var calendar = $('#calendar').fullCalendar({
defaultView: 'month',
timeZone: 'local',
editable: true,
selectable: true,
selectHelper: false,
select: function(start, end) {
//alert(start);
//alert(end);
$('#event_start_date').val(moment(start).format('YYYY-MM-DD'));
$('#event_end_date').val(moment(end).format('YYYY-MM-DD'));
$('#event_entry_modal').modal('show');
},
events: events,
eventRender: function(event, element, view) {
element.find('.fc-title').append(" <b>" + event.end +"</b>");
element.bind('click', function() {
alert(event.end);
});
}
}); //end fullCalendar block
},//end success block
error: function (xhr, status) {
alert(response.msg);
}
});
I have appended “event.end” with the event title but the event.end is being displayed in milliseconds. I want it to show in YYYY-MM-DD as per my database and JSON data. I have checked the JSON data to be passing YYYY-MM-DD (2023-08-13).
My output is displayed as below. I want the event to be displayed as “GovernmentHoliday 2023-08-13”.
The alert seem to be displaying correctly though
element.bind('click', function() {
alert(event.end);
});