{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/16917","labels_url":"https://api.github.com/repos/rails/rails/issues/16917/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/16917/comments","events_url":"https://api.github.com/repos/rails/rails/issues/16917/events","html_url":"https://github.com/rails/rails/pull/16917","id":42721006,"number":16917,"title":"Methods for ActiveSupport::Duration parsing from ISO 8601 and output to it","user":{"login":"Envek","id":264400,"avatar_url":"https://avatars.githubusercontent.com/u/264400?v=3","gravatar_id":"","url":"https://api.github.com/users/Envek","html_url":"https://github.com/Envek","followers_url":"https://api.github.com/users/Envek/followers","following_url":"https://api.github.com/users/Envek/following{/other_user}","gists_url":"https://api.github.com/users/Envek/gists{/gist_id}","starred_url":"https://api.github.com/users/Envek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Envek/subscriptions","organizations_url":"https://api.github.com/users/Envek/orgs","repos_url":"https://api.github.com/users/Envek/repos","events_url":"https://api.github.com/users/Envek/events{/privacy}","received_events_url":"https://api.github.com/users/Envek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activesupport","name":"activesupport","color":"FC9300"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2014-09-14T13:54:05Z","updated_at":"2015-02-08T19:50:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/16917","html_url":"https://github.com/rails/rails/pull/16917","diff_url":"https://github.com/rails/rails/pull/16917.diff","patch_url":"https://github.com/rails/rails/pull/16917.patch"},"body":"This PR add methods to `ActiveSupport::Duration` to allow present it in [ISO 8601 Duration] format and instantiate from it.\r\n\r\n[ISO 8601 Duration] format is standartized way to represent duration for interchange, it's already recognized by some database engines (e.g. PostgreSQL) and client side libraries (e.g. [plugin for Moment.js durations](https://github.com/dordille/moment-isoduration)). So, I think it should be part of `ActiveSupport::Duration`.\r\n\r\nSome parts of code and tests are taken from [ISO8601 gem] by Arnau Siches (@arnau) and contributors. Many thanks to them.\r\n\r\nThis PR is required for PostgreSQL `interval` datatype support (for converting it from and to `ActiveSupport::Duration`) as I've proposed in Google Group [here](https://groups.google.com/forum/#!topic/rubyonrails-core/zcscu1p4ucA). See #16919. Because of that my parsing allows individual datetime parts to be negative (see [PostgreSQL interval output]).\r\n\r\nThere is no backward incompatible changes as I want it to be included in upcoming 4.2 release, if it still possible (pleeeaasee!).\r\n\r\n[ISO 8601 Duration]: http://en.wikipedia.org/wiki/ISO_8601#Durations\r\n[ISO8601 gem]: https://github.com/arnau/ISO8601\r\n[PostgreSQL interval output]: http://www.postgresql.org/docs/9.4/static/datatype-datetime.html#DATATYPE-INTERVAL-OUTPUT"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/73427981","html_url":"https://github.com/rails/rails/pull/16917#issuecomment-73427981","issue_url":"https://api.github.com/repos/rails/rails/issues/16917","id":73427981,"user":{"login":"fxn","id":3387,"avatar_url":"https://avatars.githubusercontent.com/u/3387?v=3","gravatar_id":"","url":"https://api.github.com/users/fxn","html_url":"https://github.com/fxn","followers_url":"https://api.github.com/users/fxn/followers","following_url":"https://api.github.com/users/fxn/following{/other_user}","gists_url":"https://api.github.com/users/fxn/gists{/gist_id}","starred_url":"https://api.github.com/users/fxn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fxn/subscriptions","organizations_url":"https://api.github.com/users/fxn/orgs","repos_url":"https://api.github.com/users/fxn/repos","events_url":"https://api.github.com/users/fxn/events{/privacy}","received_events_url":"https://api.github.com/users/fxn/received_events","type":"User","site_admin":false},"created_at":"2015-02-08T19:50:29Z","updated_at":"2015-02-08T19:50:29Z","body":"Looks like a regular Ruby warning for circular requires (an autoloading error would look [like this](https://github.com/rails/rails/blob/master/activesupport/lib/active_support/dependencies.rb#L492)). I can't tonight but will have a look as soon as I can."}}