I am currently writing a site that interacts with Facebook and creates events for users. I use Javascript to dispatch an event that dispatches successfully. The problem is that the time displayed on Facebook is away from the time I post.
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) {
Yes, we use Django there.
{{show_time.start_time | date: 'U'}} will be placed in the timestamp. I also send data in ISO 8601 format with the same results. We do not currently have time zone information in dates. I'm not sure if this is causing the problem, because to check, I added -06: 00 to start_time, and it still found a bug on Facebook.
What bothers me is in the docs on Facebook, they show a curl line that supposedly creates the event, and the start_time that they send is the timestamp of the era. In other parts of the same page, they say that start_time should be ISO 8601. I also read that you need to convert your datetime to Pacific time, and then convert to an era timestamp, and then present it as start_time. I just want to know what is the right way. Facebook docs look pretty bad, so I hope SO helps! Who actually created the event with Facebook via the Javascript API and did it show the correct time on the site? How did you do that?
source share