I am currently writing a site that interacts with Facebook and creates events for users. I am using Javascript to submit the event, which is submitting successfully. The problem is, the time that is displayed on Facebook is way off from the time I am submitting.
Here is my code:
var event = {
start_time: '{{ show_time.start_time|date:'U' }}',
name: 'Movie Night: ' + '{{ show_time.movie.title }}'
};
FB.api('/me/events', 'post', event, function(response) {
// Send invites, etc...
});
Yes, we're using some Django in there.
{{ show_time.start_time|date:'U' }} will put in an epoch timestamp. I have also send in an ISO 8601 datetime with the same results. Currently, we have no timezone information in the datetimes. I am not sure if that is causing the problem though, because to test, I had appended -06:00 to the start_time, and it still showed up wrong on Facebook.
What is confusing me is in the docs on Facebook, they show a curl line that supposedly creates an event, and the start_time they send in is an epoch timestamp. In other parts of the same page, they say the start_time must be ISO 8601. I have also read that you need to convert your datetime to Pacific time, then convert to an epoch timestamp, then submit that as the start_time. I just want to know what the correct way is. The Facebook docs seem to be pretty bad at this, so I'm hoping SO can help! Who has actually created an event with Facebook through the Javascript API and had it show up with the correct time on the site? How did you do it?