WordCamp.org session timestamp changes

On WordCampWordCamp WordCamps are casual, locally-organized conferences covering everything related to WordPress. They're one of the places where the WordPress community comes together to teach one another what they’ve learned throughout the year and share the joy. Learn more. sites, the session times have been saved as a unix timestamp in UTC, regardless of the site’s timezone. We’ll be fixing this across all WordCamp sites, but this requires changing the session time for all sessions on all sites to include the timezone offset. This should not affect organizers or attendees, but anyone using the timestamp directly from the APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. will see a change.

You can see how we’re fixing this on GitHub, and if you have any input, please leave a reply. There was also some discussion on slack.

What’s the problem?

We were saving timestamps as if they were in UTC, regardless of the site’s timezone, which lead to technically-incorrect timestamps.

For example, if you have a site in EST, and you save a session for March 1st at 4pm, it will actually save it as “March 1st 2020 16:00 UTC”, which is not actually when that talk is. In most places this has been fine, because php’s date also assumed UTC, but as of WordPress 5.3, we have timezone-aware date functions. Additionally, these timestamps are causing headaches for using these values outside of PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. http://php.net/manual/en/intro-whatis.php., like in JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. (for gutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/) or 3rd parties developing apps.

Do I need to do anything?

If you’re an organizer, attendee, or someone else who just uses the WordCamp sites, no 👍🏻

If you have an app that uses the WordCamp REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/. to get session info (including the time), you might need to update your code.

For apps using the the v1 endpoint still, ex wp-json/posts/?type=wcb_session, the legacy timestamp will still be returned (but please update to v2 😉).

For the current endpoints (ex wp-json/wp/v2/sessions), the meta._wcpt_session_time value will now be the correct timestamp. If you’re manually calculating a timezone offset to display the “right” time, you can remove that code. If you can’t change right away, add ?wc_session_utc=true to your requests, and it will return the legacy timestamp.

I want to run the script to convert these times next week (Feb 12th), Feb 18th and these values will change immediately. You can add the legacy query to your request now, and it will not do anything until the change is made.

+make.wordpress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org//community