Incorrect event time display for my event on Facebook (sent via Javascript)

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) { // Send invites, etc... }); 

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?

+4
source share
1 answer

First of all, there is a mistake in managing the Facebook time zone. If you check the event in the API and on Facebook, you will see different dates. The correct API date and the wrong date on Facebook because you are adding an API event. If you created an event on Facebook, the API will display an invalid date.

If you try any call to the API event, you can see the format used:

 "end_time": "2010-03-15T00:30:00+0000" 

As you can see, the date / time format is ISO 8601, and you should use it, but maybe an era timestamp should work. If you look at the time zone (UTC, +0000), you can invite you to convert your local date to UTC (+0000), but this is a problem.

The date needs to be converted to the PST / PDT time zone, but the UTC time zone pointer is saved (+0000) , as Mike Lambert found http://bugs.developers.facebook.net/show_bug.cgi?id=12558

I assume that at the moment the API is wrong, but predictably wrong, and fixing it will just violate other Developers. Therefore, you can claim that this is a mistake in the documentation: http://developers.facebook.com/docs/reference/api/event

This should be the UTC ISO format once everyone has to be converted to PST / PDT to retrieve the time of the event entered by the user. (Which does not correspond to the time of the UTC / GMT event will really happen.)

+5
source

All Articles