返回開發人員最新消息

Platform Migration: Events Timezone Support

2012年8月1日發佈者:Eduardo Maia

We recently added support for timezones as well as date-only events (those with a date but no time yet defined) for events on Facebook to make it easier for friends to share events make plans together. Today, we are extending this support to our developer APIs.

Until recently, there was no good way to specify an event happening in a different timezone. Facebook Events used to be timezone independent, meaning people would specify a date and time for their event (e.g., July 4th, 2012 at 7:00 PM), and this would render identically to everyone, regardless of what timezone they were in. It was up to the person to infer what time the event actually started based on where it took place. This was problematic for friends who wanted to enjoy live events together, such as sporting events, which may start at 6:30 PM ET but 3:30 PM PT.

Starting today, the following changes will be made to our platform APIs to support event timezones. Any apps created as of today will automatically get timezone support. Existing apps may opt-in to timezone support by going to the App Dashboard, clicking on Settings > Advanced, and changing the 'Events Timezone' migration field to 'Enabled'. This is a 90-day breaking change; timezone support will be added to all apps in 90 days.

FQL API Changes

The following changes apply to the event and event_member tables.

Before 'events_timezone' migration:

  • start_time and end_time fields were UNIX timestamps in Pacific Time.
  • Example: '1341453600' to represent July 4th, 2012 at 7PM.
  • end_time was always defined.

After 'events_timezone' migration:

  • start_time and end_time fields are ISO-8601 formatted strings.
  • end_time may be null if none was specified.
  • See event table reference for possible time formats.

Graph API Changes (Read Side)

The following changes apply to the Event object.

Before 'events_timezone' migration:

  • start_time and end_time fields were returned as ISO-8601 strings with no offset.
  • Example: '2012-07-04T19:00:00' to represent July 4th, 2012 at 7PM.
  • You could use the 'date_format' query parameter to convert these strings to a different format.
  • end_time was always defined.

After 'events_timezone' migration:

  • start_time and end_time fields are ISO-8601 formatted strings.
  • The 'date_format' query parameter has no effect on these values.
  • end_time may be null if none was specified.
  • See Event object reference for possible time formats.

Graph API Changes (Write Side)

The following changes apply to creating new events via the User object.

Before 'events_timezone' migration:

  • start_time and end_time could be any string accepted by strtotime.
  • All times were interpreted in Pacific Time.

After 'events_timezone' migration:

  • start_time and end_time fields must be ISO-8601 formatted strings.
  • Formats accepted:
  • Date-only (e.g., '2012-07-04')
  • Precise time with offset from UTC (e.g., '2012-07-04T19:00:00-0700').
  • See events section in User object reference for more details.