{"action":"created","comment":{"url":"https://api.github.com/repos/Intrepidd/working_hours/pulls/comments/42322979","id":42322979,"diff_hunk":"@@ -85,6 +85,26 @@ def advance_to_working_time time, config: nil\n       end\n     end\n \n+    def advance_to_closing_time time, config: nil\n+      config ||= wh_config\n+      time = in_config_zone(time, config: config).round\n+      loop do\n+        # skip holidays and weekends\n+        while not working_day?(time, config: config)\n+          time = (time + 1.day).beginning_of_day\n+        end\n+        # find next working range after time\n+        time_in_day = time.seconds_since_midnight\n+        time = time.beginning_of_day","path":"lib/working_hours/computation.rb","position":14,"original_position":14,"commit_id":"6cf4a1c47e9ad504c0a88ed136be28cc7f4f34cb","original_commit_id":"6cf4a1c47e9ad504c0a88ed136be28cc7f4f34cb","user":{"login":"jarthod","id":201687,"avatar_url":"https://avatars.githubusercontent.com/u/201687?v=3","gravatar_id":"","url":"https://api.github.com/users/jarthod","html_url":"https://github.com/jarthod","followers_url":"https://api.github.com/users/jarthod/followers","following_url":"https://api.github.com/users/jarthod/following{/other_user}","gists_url":"https://api.github.com/users/jarthod/gists{/gist_id}","starred_url":"https://api.github.com/users/jarthod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarthod/subscriptions","organizations_url":"https://api.github.com/users/jarthod/orgs","repos_url":"https://api.github.com/users/jarthod/repos","events_url":"https://api.github.com/users/jarthod/events{/privacy}","received_events_url":"https://api.github.com/users/jarthod/received_events","type":"User","site_admin":false},"body":"Ah I see, you properly changed the return and increment so it's fine.\r\nCan you please also add a test for the custom \"midnight\" handling (24:00) being represented as (23:59:59.99999)\r\nSo test with period ending at 24:00 and with current time being midnight or stuff like that.","created_at":"2015-10-18T16:51:02Z","updated_at":"2015-10-18T16:51:02Z","html_url":"https://github.com/Intrepidd/working_hours/pull/21#discussion_r42322979","pull_request_url":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/Intrepidd/working_hours/pulls/comments/42322979"},"html":{"href":"https://github.com/Intrepidd/working_hours/pull/21#discussion_r42322979"},"pull_request":{"href":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21","id":47877847,"html_url":"https://github.com/Intrepidd/working_hours/pull/21","diff_url":"https://github.com/Intrepidd/working_hours/pull/21.diff","patch_url":"https://github.com/Intrepidd/working_hours/pull/21.patch","issue_url":"https://api.github.com/repos/Intrepidd/working_hours/issues/21","number":21,"state":"open","locked":false,"title":"Advance to closing time","user":{"login":"james2m","id":677,"avatar_url":"https://avatars.githubusercontent.com/u/677?v=3","gravatar_id":"","url":"https://api.github.com/users/james2m","html_url":"https://github.com/james2m","followers_url":"https://api.github.com/users/james2m/followers","following_url":"https://api.github.com/users/james2m/following{/other_user}","gists_url":"https://api.github.com/users/james2m/gists{/gist_id}","starred_url":"https://api.github.com/users/james2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james2m/subscriptions","organizations_url":"https://api.github.com/users/james2m/orgs","repos_url":"https://api.github.com/users/james2m/repos","events_url":"https://api.github.com/users/james2m/events{/privacy}","received_events_url":"https://api.github.com/users/james2m/received_events","type":"User","site_admin":false},"body":"Added an advance_to_closing time method to do just that, plus working test.","created_at":"2015-10-16T07:15:49Z","updated_at":"2015-10-18T16:51:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32865aa7561f02124c88b21a8e3a39ecaf7307c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21/commits","review_comments_url":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21/comments","review_comment_url":"https://api.github.com/repos/Intrepidd/working_hours/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Intrepidd/working_hours/issues/21/comments","statuses_url":"https://api.github.com/repos/Intrepidd/working_hours/statuses/6cf4a1c47e9ad504c0a88ed136be28cc7f4f34cb","head":{"label":"james2m:advance-to-closing-time","ref":"advance-to-closing-time","sha":"6cf4a1c47e9ad504c0a88ed136be28cc7f4f34cb","user":{"login":"james2m","id":677,"avatar_url":"https://avatars.githubusercontent.com/u/677?v=3","gravatar_id":"","url":"https://api.github.com/users/james2m","html_url":"https://github.com/james2m","followers_url":"https://api.github.com/users/james2m/followers","following_url":"https://api.github.com/users/james2m/following{/other_user}","gists_url":"https://api.github.com/users/james2m/gists{/gist_id}","starred_url":"https://api.github.com/users/james2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james2m/subscriptions","organizations_url":"https://api.github.com/users/james2m/orgs","repos_url":"https://api.github.com/users/james2m/repos","events_url":"https://api.github.com/users/james2m/events{/privacy}","received_events_url":"https://api.github.com/users/james2m/received_events","type":"User","site_admin":false},"repo":{"id":44325634,"name":"working_hours","full_name":"james2m/working_hours","owner":{"login":"james2m","id":677,"avatar_url":"https://avatars.githubusercontent.com/u/677?v=3","gravatar_id":"","url":"https://api.github.com/users/james2m","html_url":"https://github.com/james2m","followers_url":"https://api.github.com/users/james2m/followers","following_url":"https://api.github.com/users/james2m/following{/other_user}","gists_url":"https://api.github.com/users/james2m/gists{/gist_id}","starred_url":"https://api.github.com/users/james2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/james2m/subscriptions","organizations_url":"https://api.github.com/users/james2m/orgs","repos_url":"https://api.github.com/users/james2m/repos","events_url":"https://api.github.com/users/james2m/events{/privacy}","received_events_url":"https://api.github.com/users/james2m/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/james2m/working_hours","description":"⏰ A modern ruby gem allowing to do time calculation with business / working hours.","fork":true,"url":"https://api.github.com/repos/james2m/working_hours","forks_url":"https://api.github.com/repos/james2m/working_hours/forks","keys_url":"https://api.github.com/repos/james2m/working_hours/keys{/key_id}","collaborators_url":"https://api.github.com/repos/james2m/working_hours/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/james2m/working_hours/teams","hooks_url":"https://api.github.com/repos/james2m/working_hours/hooks","issue_events_url":"https://api.github.com/repos/james2m/working_hours/issues/events{/number}","events_url":"https://api.github.com/repos/james2m/working_hours/events","assignees_url":"https://api.github.com/repos/james2m/working_hours/assignees{/user}","branches_url":"https://api.github.com/repos/james2m/working_hours/branches{/branch}","tags_url":"https://api.github.com/repos/james2m/working_hours/tags","blobs_url":"https://api.github.com/repos/james2m/working_hours/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/james2m/working_hours/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/james2m/working_hours/git/refs{/sha}","trees_url":"https://api.github.com/repos/james2m/working_hours/git/trees{/sha}","statuses_url":"https://api.github.com/repos/james2m/working_hours/statuses/{sha}","languages_url":"https://api.github.com/repos/james2m/working_hours/languages","stargazers_url":"https://api.github.com/repos/james2m/working_hours/stargazers","contributors_url":"https://api.github.com/repos/james2m/working_hours/contributors","subscribers_url":"https://api.github.com/repos/james2m/working_hours/subscribers","subscription_url":"https://api.github.com/repos/james2m/working_hours/subscription","commits_url":"https://api.github.com/repos/james2m/working_hours/commits{/sha}","git_commits_url":"https://api.github.com/repos/james2m/working_hours/git/commits{/sha}","comments_url":"https://api.github.com/repos/james2m/working_hours/comments{/number}","issue_comment_url":"https://api.github.com/repos/james2m/working_hours/issues/comments{/number}","contents_url":"https://api.github.com/repos/james2m/working_hours/contents/{+path}","compare_url":"https://api.github.com/repos/james2m/working_hours/compare/{base}...{head}","merges_url":"https://api.github.com/repos/james2m/working_hours/merges","archive_url":"https://api.github.com/repos/james2m/working_hours/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/james2m/working_hours/downloads","issues_url":"https://api.github.com/repos/james2m/working_hours/issues{/number}","pulls_url":"https://api.github.com/repos/james2m/working_hours/pulls{/number}","milestones_url":"https://api.github.com/repos/james2m/working_hours/milestones{/number}","notifications_url":"https://api.github.com/repos/james2m/working_hours/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/james2m/working_hours/labels{/name}","releases_url":"https://api.github.com/repos/james2m/working_hours/releases{/id}","created_at":"2015-10-15T15:07:14Z","updated_at":"2015-10-15T15:07:15Z","pushed_at":"2015-10-16T05:45:48Z","git_url":"git://github.com/james2m/working_hours.git","ssh_url":"git@github.com:james2m/working_hours.git","clone_url":"https://github.com/james2m/working_hours.git","svn_url":"https://github.com/james2m/working_hours","homepage":"https://github.com/Intrepidd/working_hours","size":171,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Intrepidd:master","ref":"master","sha":"a046c420420e7aeb677915afa36d5d80b2ea9848","user":{"login":"Intrepidd","id":803765,"avatar_url":"https://avatars.githubusercontent.com/u/803765?v=3","gravatar_id":"","url":"https://api.github.com/users/Intrepidd","html_url":"https://github.com/Intrepidd","followers_url":"https://api.github.com/users/Intrepidd/followers","following_url":"https://api.github.com/users/Intrepidd/following{/other_user}","gists_url":"https://api.github.com/users/Intrepidd/gists{/gist_id}","starred_url":"https://api.github.com/users/Intrepidd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Intrepidd/subscriptions","organizations_url":"https://api.github.com/users/Intrepidd/orgs","repos_url":"https://api.github.com/users/Intrepidd/repos","events_url":"https://api.github.com/users/Intrepidd/events{/privacy}","received_events_url":"https://api.github.com/users/Intrepidd/received_events","type":"User","site_admin":false},"repo":{"id":19708200,"name":"working_hours","full_name":"Intrepidd/working_hours","owner":{"login":"Intrepidd","id":803765,"avatar_url":"https://avatars.githubusercontent.com/u/803765?v=3","gravatar_id":"","url":"https://api.github.com/users/Intrepidd","html_url":"https://github.com/Intrepidd","followers_url":"https://api.github.com/users/Intrepidd/followers","following_url":"https://api.github.com/users/Intrepidd/following{/other_user}","gists_url":"https://api.github.com/users/Intrepidd/gists{/gist_id}","starred_url":"https://api.github.com/users/Intrepidd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Intrepidd/subscriptions","organizations_url":"https://api.github.com/users/Intrepidd/orgs","repos_url":"https://api.github.com/users/Intrepidd/repos","events_url":"https://api.github.com/users/Intrepidd/events{/privacy}","received_events_url":"https://api.github.com/users/Intrepidd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Intrepidd/working_hours","description":"⏰ A modern ruby gem allowing to do time calculation with business / working hours.","fork":false,"url":"https://api.github.com/repos/Intrepidd/working_hours","forks_url":"https://api.github.com/repos/Intrepidd/working_hours/forks","keys_url":"https://api.github.com/repos/Intrepidd/working_hours/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Intrepidd/working_hours/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Intrepidd/working_hours/teams","hooks_url":"https://api.github.com/repos/Intrepidd/working_hours/hooks","issue_events_url":"https://api.github.com/repos/Intrepidd/working_hours/issues/events{/number}","events_url":"https://api.github.com/repos/Intrepidd/working_hours/events","assignees_url":"https://api.github.com/repos/Intrepidd/working_hours/assignees{/user}","branches_url":"https://api.github.com/repos/Intrepidd/working_hours/branches{/branch}","tags_url":"https://api.github.com/repos/Intrepidd/working_hours/tags","blobs_url":"https://api.github.com/repos/Intrepidd/working_hours/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Intrepidd/working_hours/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Intrepidd/working_hours/git/refs{/sha}","trees_url":"https://api.github.com/repos/Intrepidd/working_hours/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Intrepidd/working_hours/statuses/{sha}","languages_url":"https://api.github.com/repos/Intrepidd/working_hours/languages","stargazers_url":"https://api.github.com/repos/Intrepidd/working_hours/stargazers","contributors_url":"https://api.github.com/repos/Intrepidd/working_hours/contributors","subscribers_url":"https://api.github.com/repos/Intrepidd/working_hours/subscribers","subscription_url":"https://api.github.com/repos/Intrepidd/working_hours/subscription","commits_url":"https://api.github.com/repos/Intrepidd/working_hours/commits{/sha}","git_commits_url":"https://api.github.com/repos/Intrepidd/working_hours/git/commits{/sha}","comments_url":"https://api.github.com/repos/Intrepidd/working_hours/comments{/number}","issue_comment_url":"https://api.github.com/repos/Intrepidd/working_hours/issues/comments{/number}","contents_url":"https://api.github.com/repos/Intrepidd/working_hours/contents/{+path}","compare_url":"https://api.github.com/repos/Intrepidd/working_hours/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Intrepidd/working_hours/merges","archive_url":"https://api.github.com/repos/Intrepidd/working_hours/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Intrepidd/working_hours/downloads","issues_url":"https://api.github.com/repos/Intrepidd/working_hours/issues{/number}","pulls_url":"https://api.github.com/repos/Intrepidd/working_hours/pulls{/number}","milestones_url":"https://api.github.com/repos/Intrepidd/working_hours/milestones{/number}","notifications_url":"https://api.github.com/repos/Intrepidd/working_hours/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Intrepidd/working_hours/labels{/name}","releases_url":"https://api.github.com/repos/Intrepidd/working_hours/releases{/id}","created_at":"2014-05-12T17:26:08Z","updated_at":"2015-10-12T18:14:55Z","pushed_at":"2015-10-16T07:16:51Z","git_url":"git://github.com/Intrepidd/working_hours.git","ssh_url":"git@github.com:Intrepidd/working_hours.git","clone_url":"https://github.com/Intrepidd/working_hours.git","svn_url":"https://github.com/Intrepidd/working_hours","homepage":"https://github.com/Intrepidd/working_hours","size":546,"stargazers_count":242,"watchers_count":242,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":5,"forks":18,"open_issues":5,"watchers":242,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21"},"html":{"href":"https://github.com/Intrepidd/working_hours/pull/21"},"issue":{"href":"https://api.github.com/repos/Intrepidd/working_hours/issues/21"},"comments":{"href":"https://api.github.com/repos/Intrepidd/working_hours/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/Intrepidd/working_hours/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Intrepidd/working_hours/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/Intrepidd/working_hours/statuses/6cf4a1c47e9ad504c0a88ed136be28cc7f4f34cb"}}}}