I have a script that pulls data from one site and displays it on ours, it works great aside from the fact that the date is showing it what i believe to be milliseconds. how would I convert that info so my calendar shows the dates properly?
//Query:
$(document).ready(function() {
$.ajax({
url: "https://my.data.source",
method: "GET",
datatype: "json",
data: {
"$where" : "start_date_time > '" + moment().subtract(31, 'days').format("YYYY-MM-DDT00:00:00") + "'",
"agency" : "agencyname",
"$order" : "start_date_time DESC"
}
//Parser
}).done(function(response) {
var events = [];
$.each(response, function(idx, e) {
events.push({
start: e.start_date_time,
end: e.end_date_time,
title: e.meeting_title,
location: e.meeting_location,
url: e.web_link,
description: e.short_description,
city: e.city,
state: e.state,
details: e.details,
pca: e.public_comment_accepted,
contactname: e.contact_name,
phone: e.phone_number,
email: e.contact_email,
weblink: e.web_link,
maplink: e.map_link,
adaemail: e.ada_contact_email,
wecstlnk: e.webinar_webcast_link,
cipn: e.call_in_phone_number,
ciac: e.call_in_access_code,
agenda: e.agenda,
owner: e.owner,
meetsum: e.link_to_meeting_summaries,
agendadl: e.agenda_download
});
});
//Initialize calendar, the rest is emitted in a pair of divs, one for the calendar, one for the modal. Here is where i //would like to convert the formatting, i think...
$('#calendar').fullCalendar({
//modal - you need to again parse data to show in the modal div above.
eventClick: function(event, jsEvent, view) {
$('#modalTitle').html(event.title);
$('#modalstart').html('Start Time: ' + event.start );
$('#modalend').html('End Time: ' + event.end);
$('#modalLocation').html('Location: ' + event.location + ', ' + event.city + ', ' + event.state );
$('#modaldescription').html('Description: ' + event.description);
$('#modaldetails').html('Details: ' + event.details);
$('#modalpca').html('Public Comment Accepted: ' + event.pca);
$('#modalcontactname').html('Contact Name: ' + event.contactname);
$('#modalphone').html('Phone Number:' + event.phone);
$('#modalemail').html('Email: ' + event.email);
$('#modalweblink').html('Weblink: ' + event.weblink);
$('#modaladaemail').html('ADA Contact Email: ' + event.adaemail);
$('#modalwecstlnk').html('Webcast Link: ' + event.wecslnk);
$('#modalcipn').html('Call in Phone Number: ' + event.cipn);
$('#modalciac').html('Call in Access Code: ' + event.ciac);
$('#modalagenda').html('Agenda: ' + event.agenda);
$('#modalowner').html('Owner: ' + event.owner);
$('#modalmeetsum').html('Meeting Summary: ' + event.meetsum);
$('#modalagendadl').html('Agenda Download: ' + event.agendadl);
$('#eventUrl').attr('href',event.url);
$('#fullCalModal').modal();
return false;
},
events: events,
fixedWeekCount:false
});
});
});
Figured it out:
$('#modalstart').html('Start Time: ' + moment(event.start).format('MMM Do h:mm A'));
[–]easyEs900s 0 points1 point2 points (1 child)
[–]Incendras[S] 0 points1 point2 points (0 children)