{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/213397535","pull_request_review_id":150225581,"id":213397535,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzM5NzUzNQ==","diff_hunk":"@@ -757,20 +748,41 @@ defmodule Calendar.ISO do\n     if leap_year?(year), do: 1, else: 0\n   end\n \n+  defp days_to_year(days) when days < 0 do\n+    year_estimate = -div(-days, @days_per_nonleap_year) - 1\n+\n+    {year, days_before_year} =\n+      days_to_year(year_estimate, days, days_to_end_of_epoch(year_estimate))\n+\n+    leap_year_pad = if leap_year?(year), do: 1, else: 0\n+    {year, leap_year_pad + 365 + days - days_before_year}","path":"lib/elixir/lib/calendar/iso.ex","position":35,"original_position":35,"commit_id":"1619fc97bddb9797026899568c2a7989c982d777","original_commit_id":"1619fc97bddb9797026899568c2a7989c982d777","user":{"login":"paulanthonywilson","id":2986,"node_id":"MDQ6VXNlcjI5ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/2986?v=4","gravatar_id":"","url":"https://api.github.com/users/paulanthonywilson","html_url":"https://github.com/paulanthonywilson","followers_url":"https://api.github.com/users/paulanthonywilson/followers","following_url":"https://api.github.com/users/paulanthonywilson/following{/other_user}","gists_url":"https://api.github.com/users/paulanthonywilson/gists{/gist_id}","starred_url":"https://api.github.com/users/paulanthonywilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulanthonywilson/subscriptions","organizations_url":"https://api.github.com/users/paulanthonywilson/orgs","repos_url":"https://api.github.com/users/paulanthonywilson/repos","events_url":"https://api.github.com/users/paulanthonywilson/events{/privacy}","received_events_url":"https://api.github.com/users/paulanthonywilson/received_events","type":"User","site_admin":false},"body":"Good catch","created_at":"2018-08-28T17:09:16Z","updated_at":"2018-08-28T17:09:16Z","html_url":"https://github.com/elixir-lang/elixir/pull/8145#discussion_r213397535","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/213397535"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/8145#discussion_r213397535"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145"}},"in_reply_to_id":213372484},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145","id":211453550,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExNDUzNTUw","html_url":"https://github.com/elixir-lang/elixir/pull/8145","diff_url":"https://github.com/elixir-lang/elixir/pull/8145.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/8145.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/8145","number":8145,"state":"open","locked":false,"title":"Fix for converting from negative iso days on New Year in a leap year","user":{"login":"paulanthonywilson","id":2986,"node_id":"MDQ6VXNlcjI5ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/2986?v=4","gravatar_id":"","url":"https://api.github.com/users/paulanthonywilson","html_url":"https://github.com/paulanthonywilson","followers_url":"https://api.github.com/users/paulanthonywilson/followers","following_url":"https://api.github.com/users/paulanthonywilson/following{/other_user}","gists_url":"https://api.github.com/users/paulanthonywilson/gists{/gist_id}","starred_url":"https://api.github.com/users/paulanthonywilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulanthonywilson/subscriptions","organizations_url":"https://api.github.com/users/paulanthonywilson/orgs","repos_url":"https://api.github.com/users/paulanthonywilson/repos","events_url":"https://api.github.com/users/paulanthonywilson/events{/privacy}","received_events_url":"https://api.github.com/users/paulanthonywilson/received_events","type":"User","site_admin":false},"body":"👋 \r\n\r\nThis is a fix for https://github.com/elixir-lang/elixir/issues/8128\r\n\r\ntldr; it was a bug with the 1st of January, on negative leap years - converting back from `iso_days` gave us the 32nd of December on the previous year.\r\n\r\n","created_at":"2018-08-28T14:57:50Z","updated_at":"2018-08-28T17:09:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70cd9e16a9454401033e762b3d91133c8ec50130","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/8145/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/1619fc97bddb9797026899568c2a7989c982d777","head":{"label":"paulanthonywilson:fix-negative-leap-year-converting-from-iso-days","ref":"fix-negative-leap-year-converting-from-iso-days","sha":"1619fc97bddb9797026899568c2a7989c982d777","user":{"login":"paulanthonywilson","id":2986,"node_id":"MDQ6VXNlcjI5ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/2986?v=4","gravatar_id":"","url":"https://api.github.com/users/paulanthonywilson","html_url":"https://github.com/paulanthonywilson","followers_url":"https://api.github.com/users/paulanthonywilson/followers","following_url":"https://api.github.com/users/paulanthonywilson/following{/other_user}","gists_url":"https://api.github.com/users/paulanthonywilson/gists{/gist_id}","starred_url":"https://api.github.com/users/paulanthonywilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulanthonywilson/subscriptions","organizations_url":"https://api.github.com/users/paulanthonywilson/orgs","repos_url":"https://api.github.com/users/paulanthonywilson/repos","events_url":"https://api.github.com/users/paulanthonywilson/events{/privacy}","received_events_url":"https://api.github.com/users/paulanthonywilson/received_events","type":"User","site_admin":false},"repo":{"id":146189858,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYxODk4NTg=","name":"elixir","full_name":"paulanthonywilson/elixir","owner":{"login":"paulanthonywilson","id":2986,"node_id":"MDQ6VXNlcjI5ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/2986?v=4","gravatar_id":"","url":"https://api.github.com/users/paulanthonywilson","html_url":"https://github.com/paulanthonywilson","followers_url":"https://api.github.com/users/paulanthonywilson/followers","following_url":"https://api.github.com/users/paulanthonywilson/following{/other_user}","gists_url":"https://api.github.com/users/paulanthonywilson/gists{/gist_id}","starred_url":"https://api.github.com/users/paulanthonywilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulanthonywilson/subscriptions","organizations_url":"https://api.github.com/users/paulanthonywilson/orgs","repos_url":"https://api.github.com/users/paulanthonywilson/repos","events_url":"https://api.github.com/users/paulanthonywilson/events{/privacy}","received_events_url":"https://api.github.com/users/paulanthonywilson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paulanthonywilson/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":true,"url":"https://api.github.com/repos/paulanthonywilson/elixir","forks_url":"https://api.github.com/repos/paulanthonywilson/elixir/forks","keys_url":"https://api.github.com/repos/paulanthonywilson/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paulanthonywilson/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paulanthonywilson/elixir/teams","hooks_url":"https://api.github.com/repos/paulanthonywilson/elixir/hooks","issue_events_url":"https://api.github.com/repos/paulanthonywilson/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/paulanthonywilson/elixir/events","assignees_url":"https://api.github.com/repos/paulanthonywilson/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/paulanthonywilson/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/paulanthonywilson/elixir/tags","blobs_url":"https://api.github.com/repos/paulanthonywilson/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paulanthonywilson/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paulanthonywilson/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/paulanthonywilson/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paulanthonywilson/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/paulanthonywilson/elixir/languages","stargazers_url":"https://api.github.com/repos/paulanthonywilson/elixir/stargazers","contributors_url":"https://api.github.com/repos/paulanthonywilson/elixir/contributors","subscribers_url":"https://api.github.com/repos/paulanthonywilson/elixir/subscribers","subscription_url":"https://api.github.com/repos/paulanthonywilson/elixir/subscription","commits_url":"https://api.github.com/repos/paulanthonywilson/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/paulanthonywilson/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/paulanthonywilson/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/paulanthonywilson/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/paulanthonywilson/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/paulanthonywilson/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paulanthonywilson/elixir/merges","archive_url":"https://api.github.com/repos/paulanthonywilson/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paulanthonywilson/elixir/downloads","issues_url":"https://api.github.com/repos/paulanthonywilson/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/paulanthonywilson/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/paulanthonywilson/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/paulanthonywilson/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paulanthonywilson/elixir/labels{/name}","releases_url":"https://api.github.com/repos/paulanthonywilson/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/paulanthonywilson/elixir/deployments","created_at":"2018-08-26T14:53:36Z","updated_at":"2018-08-28T14:55:56Z","pushed_at":"2018-08-28T15:40:21Z","git_url":"git://github.com/paulanthonywilson/elixir.git","ssh_url":"git@github.com:paulanthonywilson/elixir.git","clone_url":"https://github.com/paulanthonywilson/elixir.git","svn_url":"https://github.com/paulanthonywilson/elixir","homepage":"http://elixir-lang.org/","size":37686,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elixir-lang:master","ref":"master","sha":"8b101aeb4f07c5a482bd5b1d7d695c1f69557a58","user":{"login":"elixir-lang","id":1481354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODEzNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"node_id":"MDEwOlJlcG9zaXRvcnkxMjM0NzE0","name":"elixir","full_name":"elixir-lang/elixir","owner":{"login":"elixir-lang","id":1481354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODEzNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/elixir-lang/elixir/deployments","created_at":"2011-01-09T08:43:57Z","updated_at":"2018-08-28T15:54:41Z","pushed_at":"2018-08-28T15:41:43Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":37681,"stargazers_count":13753,"watchers_count":13753,"language":"Elixir","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1997,"mirror_url":null,"archived":false,"open_issues_count":32,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1997,"open_issues":32,"watchers":13753,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/8145"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/8145"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/8145/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8145/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/1619fc97bddb9797026899568c2a7989c982d777"}},"author_association":"NONE"}}
{"actor":{"display_login":"paulanthonywilson"}}