{"action":"created","issue":{"url":"https://api.github.com/repos/WP-API/WP-API/issues/1087","labels_url":"https://api.github.com/repos/WP-API/WP-API/issues/1087/labels{/name}","comments_url":"https://api.github.com/repos/WP-API/WP-API/issues/1087/comments","events_url":"https://api.github.com/repos/WP-API/WP-API/issues/1087/events","html_url":"https://github.com/WP-API/WP-API/issues/1087","id":67773108,"number":1087,"title":"Timezone settings breaking plugin","user":{"login":"nCrafts","id":2904205,"avatar_url":"https://avatars.githubusercontent.com/u/2904205?v=3","gravatar_id":"","url":"https://api.github.com/users/nCrafts","html_url":"https://github.com/nCrafts","followers_url":"https://api.github.com/users/nCrafts/followers","following_url":"https://api.github.com/users/nCrafts/following{/other_user}","gists_url":"https://api.github.com/users/nCrafts/gists{/gist_id}","starred_url":"https://api.github.com/users/nCrafts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nCrafts/subscriptions","organizations_url":"https://api.github.com/users/nCrafts/orgs","repos_url":"https://api.github.com/users/nCrafts/repos","events_url":"https://api.github.com/users/nCrafts/events{/privacy}","received_events_url":"https://api.github.com/users/nCrafts/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-11T11:05:58Z","updated_at":"2015-08-17T23:15:06Z","closed_at":"2015-08-17T23:15:06Z","body":"When I changed my timezone from UTC to UTC + 5:30, the plugin broke.\r\n\r\n```\r\nPHP Fatal error:  Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (Etc/GMT+5.5)' in /var/www/wp-content/plugins/json-rest-api/plugin.php:672\r\nStack trace:\r\n#0 /var/www/wp-content/plugins/json-rest-api/plugin.php(672): DateTimeZone->__construct('Etc/GMT+5.5')\r\n#1 /var/www/wp-content/plugins/json-rest-api/lib/class-wp-json-posts.php(584): json_get_timezone()\r\n#2 /var/www/wp-content/plugins/json-rest-api/lib/class-wp-json-posts.php(188): WP_JSON_Posts->prepare_post(Array, 'view')\r\n#3 [internal function]: WP_JSON_Posts->get_posts(Array, 'view', 'addon', 1)\r\n#4 /var/www/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php(444): call_user_func_array(Array, Array)\r\n#5 /var/www/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php(248): WP_JSON_Server->dispatch()\r\n#6 /var/www/wp-content/plugins/json-rest-api/plugin.php(182): WP_JSON_Server->serve_request('/posts')\r\n#7 [internal function]: json_api_loaded('')\\n#8 /var/www/wp-includes/plugin.php(496): call_user_func_array('json_ap in /var/www/wp-content/plugins/json-rest-api/plugin.php on line 672\r\n```\r\n\r\nSwitching back to UTC fixes the issue."},"comment":{"url":"https://api.github.com/repos/WP-API/WP-API/issues/comments/131989580","html_url":"https://github.com/WP-API/WP-API/issues/1087#issuecomment-131989580","issue_url":"https://api.github.com/repos/WP-API/WP-API/issues/1087","id":131989580,"user":{"login":"rmccue","id":21655,"avatar_url":"https://avatars.githubusercontent.com/u/21655?v=3","gravatar_id":"","url":"https://api.github.com/users/rmccue","html_url":"https://github.com/rmccue","followers_url":"https://api.github.com/users/rmccue/followers","following_url":"https://api.github.com/users/rmccue/following{/other_user}","gists_url":"https://api.github.com/users/rmccue/gists{/gist_id}","starred_url":"https://api.github.com/users/rmccue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmccue/subscriptions","organizations_url":"https://api.github.com/users/rmccue/orgs","repos_url":"https://api.github.com/users/rmccue/repos","events_url":"https://api.github.com/users/rmccue/events{/privacy}","received_events_url":"https://api.github.com/users/rmccue/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T23:15:06Z","updated_at":"2015-08-17T23:15:06Z","body":"In v1, we made the mistake of trying to use DateTimeZone. Unfortunately, that relies on having full timezone identifiers, whereas WP can use TZ identifiers or manual offsets. In your case, you're using a manual offset which doesn't exist as a DTZ identifier, so it breaks.\r\n\r\nVersion 2 switches back to the classic style of timezones (i.e. without DateTimeZone), so should work for you here. Alternatively, if you pick `Asia/Kolkata` instead, this should also work."}}