{"action":"created","comment":{"url":"https://api.github.com/repos/toggl/superday/pulls/comments/125591083","pull_request_review_id":47992517,"id":125591083,"diff_hunk":"@@ -74,4 +74,88 @@ class DateExtensionsTests : XCTestCase\n         \n         expect(date.ignoreTimeComponents()).to(equal(date2.ignoreTimeComponents()))\n     }\n+    \n+    func testTimeIntervalInWeekMeasuresCorrectlyForSameDayInDifferentWeeks()\n+    {\n+        var components = DateComponents()\n+        components.day = 31\n+        components.month = 10\n+        components.year = 2016\n+        components.hour = 12\n+        let date1 = calendar.date(from: components)!\n+        let date2 = date1.addingTimeInterval(14*24*60*60 + 60)\n+        \n+        expect(date1.timeIntervalInWeek(date2)).to(equal(60))\n+    }\n+    \n+    func testTimeIntervalInWeekMesuresCorrectlyWehnMovingFromLastDayOfWeekToFirstDayOfWeek()\n+    {\n+        var components = DateComponents()\n+        components.day = 1\n+        components.month = 07\n+        components.year = 2017\n+        components.hour = 23\n+        components.minute = 50\n+        let date1 = calendar.date(from: components)!\n+        let date2 = date1.addingTimeInterval(60*60)\n+        \n+        expect(date1.timeIntervalInWeek(date2)).to(equal(60*60))\n+    }\n+    \n+    func testTimeIntervalInWeekMesuresCorrectlyWehnMovingFromFirstDayOfWeekToLastDayOfWeek()\n+    {\n+        var components = DateComponents()\n+        components.day = 1\n+        components.month = 07\n+        components.year = 2017\n+        components.hour = 00\n+        components.minute = 50\n+        let date1 = calendar.date(from: components)!\n+        let date2 = date1.addingTimeInterval(-60*60)\n+        \n+        expect(date1.timeIntervalInWeek(date2)).to(equal(60*60))\n+    }\n+    \n+    func testTimeIntervalInWeekMesuresCorrectlyWehnMovingFromLastDayOfWeekToFirstDayOfWeekFromDifferentWeek()\n+    {\n+        var components = DateComponents()\n+        components.day = 1\n+        components.month = 07\n+        components.year = 2017\n+        components.hour = 23\n+        components.minute = 50\n+        let date1 = calendar.date(from: components)!\n+        let date2 = date1.addingTimeInterval(14*24*60*60 + 60*60)\n+        \n+        expect(date1.timeIntervalInWeek(date2)).to(equal(60*60))\n+    }\n+    \n+    func testTimeIntervalInWeekMesuresCorrectlyWehnMovingFromFirstDayOfWeekToLastDayOfWeekFromDifferentWeek()\n+    {\n+        var components = DateComponents()\n+        components.day = 1\n+        components.month = 07\n+        components.year = 2017\n+        components.hour = 00\n+        components.minute = 50\n+        let date1 = calendar.date(from: components)!\n+        let date2 = date1.addingTimeInterval(-14*24*60*60 - 60*60)\n+        \n+        expect(date1.timeIntervalInWeek(date2)).to(equal(60*60))\n+    }\n+    \n+    func testTimeIntervalInWeekReturnsThreeDaysOrLessDifferenceForDatesThatAreMoreThenThreeDaysApart()","path":"teferiTests/Extensions/DateExtensionsTests.swift","position":74,"original_position":74,"commit_id":"cad5c9b21541d419adfa0fc1a31e748dbe05de65","original_commit_id":"cad5c9b21541d419adfa0fc1a31e748dbe05de65","user":{"login":"sofokli1","id":885122,"avatar_url":"https://avatars3.githubusercontent.com/u/885122?v=3","gravatar_id":"","url":"https://api.github.com/users/sofokli1","html_url":"https://github.com/sofokli1","followers_url":"https://api.github.com/users/sofokli1/followers","following_url":"https://api.github.com/users/sofokli1/following{/other_user}","gists_url":"https://api.github.com/users/sofokli1/gists{/gist_id}","starred_url":"https://api.github.com/users/sofokli1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofokli1/subscriptions","organizations_url":"https://api.github.com/users/sofokli1/orgs","repos_url":"https://api.github.com/users/sofokli1/repos","events_url":"https://api.github.com/users/sofokli1/events{/privacy}","received_events_url":"https://api.github.com/users/sofokli1/received_events","type":"User","site_admin":false},"body":"day wise you can only move in integer values, the rest is hours and minutes. From today (regardless of the hour) you can only go 3 days in the future and if you go one more you find yourself 3 days in the past. Here i am testing that the second date collapse in the same week (in a wrap around ways) correctly. The 0.5 day is just `.timeIntervalSince...`","created_at":"2017-07-05T09:06:45Z","updated_at":"2017-07-05T09:06:45Z","html_url":"https://github.com/toggl/superday/pull/657#discussion_r125591083","pull_request_url":"https://api.github.com/repos/toggl/superday/pulls/657","_links":{"self":{"href":"https://api.github.com/repos/toggl/superday/pulls/comments/125591083"},"html":{"href":"https://github.com/toggl/superday/pull/657#discussion_r125591083"},"pull_request":{"href":"https://api.github.com/repos/toggl/superday/pulls/657"}}},"pull_request":{"url":"https://api.github.com/repos/toggl/superday/pulls/657","id":128763762,"html_url":"https://github.com/toggl/superday/pull/657","diff_url":"https://github.com/toggl/superday/pull/657.diff","patch_url":"https://github.com/toggl/superday/pull/657.patch","issue_url":"https://api.github.com/repos/toggl/superday/issues/657","number":657,"state":"open","locked":false,"title":":bug: Fix date extension","user":{"login":"sofokli1","id":885122,"avatar_url":"https://avatars3.githubusercontent.com/u/885122?v=3","gravatar_id":"","url":"https://api.github.com/users/sofokli1","html_url":"https://github.com/sofokli1","followers_url":"https://api.github.com/users/sofokli1/followers","following_url":"https://api.github.com/users/sofokli1/following{/other_user}","gists_url":"https://api.github.com/users/sofokli1/gists{/gist_id}","starred_url":"https://api.github.com/users/sofokli1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sofokli1/subscriptions","organizations_url":"https://api.github.com/users/sofokli1/orgs","repos_url":"https://api.github.com/users/sofokli1/repos","events_url":"https://api.github.com/users/sofokli1/events{/privacy}","received_events_url":"https://api.github.com/users/sofokli1/received_events","type":"User","site_admin":false},"body":"Fix timeInterval measurement when collapsing everything into a week\r\n\r\nFeel free to try dates and break the logic. I tested with crazy dates for some hours and seems to work fine.","created_at":"2017-07-04T09:40:25Z","updated_at":"2017-07-05T09:06:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8094544cdee219b6c67c1e10e9f6c9520a25663c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/toggl/superday/pulls/657/commits","review_comments_url":"https://api.github.com/repos/toggl/superday/pulls/657/comments","review_comment_url":"https://api.github.com/repos/toggl/superday/pulls/comments{/number}","comments_url":"https://api.github.com/repos/toggl/superday/issues/657/comments","statuses_url":"https://api.github.com/repos/toggl/superday/statuses/cad5c9b21541d419adfa0fc1a31e748dbe05de65","head":{"label":"toggl:fix-time-collapse","ref":"fix-time-collapse","sha":"cad5c9b21541d419adfa0fc1a31e748dbe05de65","user":{"login":"toggl","id":316475,"avatar_url":"https://avatars0.githubusercontent.com/u/316475?v=3","gravatar_id":"","url":"https://api.github.com/users/toggl","html_url":"https://github.com/toggl","followers_url":"https://api.github.com/users/toggl/followers","following_url":"https://api.github.com/users/toggl/following{/other_user}","gists_url":"https://api.github.com/users/toggl/gists{/gist_id}","starred_url":"https://api.github.com/users/toggl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toggl/subscriptions","organizations_url":"https://api.github.com/users/toggl/orgs","repos_url":"https://api.github.com/users/toggl/repos","events_url":"https://api.github.com/users/toggl/events{/privacy}","received_events_url":"https://api.github.com/users/toggl/received_events","type":"Organization","site_admin":false},"repo":{"id":66841580,"name":"superday","full_name":"toggl/superday","owner":{"login":"toggl","id":316475,"avatar_url":"https://avatars0.githubusercontent.com/u/316475?v=3","gravatar_id":"","url":"https://api.github.com/users/toggl","html_url":"https://github.com/toggl","followers_url":"https://api.github.com/users/toggl/followers","following_url":"https://api.github.com/users/toggl/following{/other_user}","gists_url":"https://api.github.com/users/toggl/gists{/gist_id}","starred_url":"https://api.github.com/users/toggl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toggl/subscriptions","organizations_url":"https://api.github.com/users/toggl/orgs","repos_url":"https://api.github.com/users/toggl/repos","events_url":"https://api.github.com/users/toggl/events{/privacy}","received_events_url":"https://api.github.com/users/toggl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/toggl/superday","description":"More time, more life.","fork":false,"url":"https://api.github.com/repos/toggl/superday","forks_url":"https://api.github.com/repos/toggl/superday/forks","keys_url":"https://api.github.com/repos/toggl/superday/keys{/key_id}","collaborators_url":"https://api.github.com/repos/toggl/superday/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/toggl/superday/teams","hooks_url":"https://api.github.com/repos/toggl/superday/hooks","issue_events_url":"https://api.github.com/repos/toggl/superday/issues/events{/number}","events_url":"https://api.github.com/repos/toggl/superday/events","assignees_url":"https://api.github.com/repos/toggl/superday/assignees{/user}","branches_url":"https://api.github.com/repos/toggl/superday/branches{/branch}","tags_url":"https://api.github.com/repos/toggl/superday/tags","blobs_url":"https://api.github.com/repos/toggl/superday/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/toggl/superday/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/toggl/superday/git/refs{/sha}","trees_url":"https://api.github.com/repos/toggl/superday/git/trees{/sha}","statuses_url":"https://api.github.com/repos/toggl/superday/statuses/{sha}","languages_url":"https://api.github.com/repos/toggl/superday/languages","stargazers_url":"https://api.github.com/repos/toggl/superday/stargazers","contributors_url":"https://api.github.com/repos/toggl/superday/contributors","subscribers_url":"https://api.github.com/repos/toggl/superday/subscribers","subscription_url":"https://api.github.com/repos/toggl/superday/subscription","commits_url":"https://api.github.com/repos/toggl/superday/commits{/sha}","git_commits_url":"https://api.github.com/repos/toggl/superday/git/commits{/sha}","comments_url":"https://api.github.com/repos/toggl/superday/comments{/number}","issue_comment_url":"https://api.github.com/repos/toggl/superday/issues/comments{/number}","contents_url":"https://api.github.com/repos/toggl/superday/contents/{+path}","compare_url":"https://api.github.com/repos/toggl/superday/compare/{base}...{head}","merges_url":"https://api.github.com/repos/toggl/superday/merges","archive_url":"https://api.github.com/repos/toggl/superday/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/toggl/superday/downloads","issues_url":"https://api.github.com/repos/toggl/superday/issues{/number}","pulls_url":"https://api.github.com/repos/toggl/superday/pulls{/number}","milestones_url":"https://api.github.com/repos/toggl/superday/milestones{/number}","notifications_url":"https://api.github.com/repos/toggl/superday/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/toggl/superday/labels{/name}","releases_url":"https://api.github.com/repos/toggl/superday/releases{/id}","deployments_url":"https://api.github.com/repos/toggl/superday/deployments","created_at":"2016-08-29T12:26:20Z","updated_at":"2017-07-03T15:16:48Z","pushed_at":"2017-07-05T06:21:33Z","git_url":"git://github.com/toggl/superday.git","ssh_url":"git@github.com:toggl/superday.git","clone_url":"https://github.com/toggl/superday.git","svn_url":"https://github.com/toggl/superday","homepage":"https://superday.toggl.com/","size":2410,"stargazers_count":6,"watchers_count":6,"language":"Swift","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":18,"forks":0,"open_issues":18,"watchers":6,"default_branch":"develop"}},"base":{"label":"toggl:develop","ref":"develop","sha":"d73f4cfc83c6427e491fcf6fa4160600889c99aa","user":{"login":"toggl","id":316475,"avatar_url":"https://avatars0.githubusercontent.com/u/316475?v=3","gravatar_id":"","url":"https://api.github.com/users/toggl","html_url":"https://github.com/toggl","followers_url":"https://api.github.com/users/toggl/followers","following_url":"https://api.github.com/users/toggl/following{/other_user}","gists_url":"https://api.github.com/users/toggl/gists{/gist_id}","starred_url":"https://api.github.com/users/toggl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toggl/subscriptions","organizations_url":"https://api.github.com/users/toggl/orgs","repos_url":"https://api.github.com/users/toggl/repos","events_url":"https://api.github.com/users/toggl/events{/privacy}","received_events_url":"https://api.github.com/users/toggl/received_events","type":"Organization","site_admin":false},"repo":{"id":66841580,"name":"superday","full_name":"toggl/superday","owner":{"login":"toggl","id":316475,"avatar_url":"https://avatars0.githubusercontent.com/u/316475?v=3","gravatar_id":"","url":"https://api.github.com/users/toggl","html_url":"https://github.com/toggl","followers_url":"https://api.github.com/users/toggl/followers","following_url":"https://api.github.com/users/toggl/following{/other_user}","gists_url":"https://api.github.com/users/toggl/gists{/gist_id}","starred_url":"https://api.github.com/users/toggl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toggl/subscriptions","organizations_url":"https://api.github.com/users/toggl/orgs","repos_url":"https://api.github.com/users/toggl/repos","events_url":"https://api.github.com/users/toggl/events{/privacy}","received_events_url":"https://api.github.com/users/toggl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/toggl/superday","description":"More time, more life.","fork":false,"url":"https://api.github.com/repos/toggl/superday","forks_url":"https://api.github.com/repos/toggl/superday/forks","keys_url":"https://api.github.com/repos/toggl/superday/keys{/key_id}","collaborators_url":"https://api.github.com/repos/toggl/superday/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/toggl/superday/teams","hooks_url":"https://api.github.com/repos/toggl/superday/hooks","issue_events_url":"https://api.github.com/repos/toggl/superday/issues/events{/number}","events_url":"https://api.github.com/repos/toggl/superday/events","assignees_url":"https://api.github.com/repos/toggl/superday/assignees{/user}","branches_url":"https://api.github.com/repos/toggl/superday/branches{/branch}","tags_url":"https://api.github.com/repos/toggl/superday/tags","blobs_url":"https://api.github.com/repos/toggl/superday/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/toggl/superday/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/toggl/superday/git/refs{/sha}","trees_url":"https://api.github.com/repos/toggl/superday/git/trees{/sha}","statuses_url":"https://api.github.com/repos/toggl/superday/statuses/{sha}","languages_url":"https://api.github.com/repos/toggl/superday/languages","stargazers_url":"https://api.github.com/repos/toggl/superday/stargazers","contributors_url":"https://api.github.com/repos/toggl/superday/contributors","subscribers_url":"https://api.github.com/repos/toggl/superday/subscribers","subscription_url":"https://api.github.com/repos/toggl/superday/subscription","commits_url":"https://api.github.com/repos/toggl/superday/commits{/sha}","git_commits_url":"https://api.github.com/repos/toggl/superday/git/commits{/sha}","comments_url":"https://api.github.com/repos/toggl/superday/comments{/number}","issue_comment_url":"https://api.github.com/repos/toggl/superday/issues/comments{/number}","contents_url":"https://api.github.com/repos/toggl/superday/contents/{+path}","compare_url":"https://api.github.com/repos/toggl/superday/compare/{base}...{head}","merges_url":"https://api.github.com/repos/toggl/superday/merges","archive_url":"https://api.github.com/repos/toggl/superday/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/toggl/superday/downloads","issues_url":"https://api.github.com/repos/toggl/superday/issues{/number}","pulls_url":"https://api.github.com/repos/toggl/superday/pulls{/number}","milestones_url":"https://api.github.com/repos/toggl/superday/milestones{/number}","notifications_url":"https://api.github.com/repos/toggl/superday/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/toggl/superday/labels{/name}","releases_url":"https://api.github.com/repos/toggl/superday/releases{/id}","deployments_url":"https://api.github.com/repos/toggl/superday/deployments","created_at":"2016-08-29T12:26:20Z","updated_at":"2017-07-03T15:16:48Z","pushed_at":"2017-07-05T06:21:33Z","git_url":"git://github.com/toggl/superday.git","ssh_url":"git@github.com:toggl/superday.git","clone_url":"https://github.com/toggl/superday.git","svn_url":"https://github.com/toggl/superday","homepage":"https://superday.toggl.com/","size":2410,"stargazers_count":6,"watchers_count":6,"language":"Swift","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":18,"forks":0,"open_issues":18,"watchers":6,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/toggl/superday/pulls/657"},"html":{"href":"https://github.com/toggl/superday/pull/657"},"issue":{"href":"https://api.github.com/repos/toggl/superday/issues/657"},"comments":{"href":"https://api.github.com/repos/toggl/superday/issues/657/comments"},"review_comments":{"href":"https://api.github.com/repos/toggl/superday/pulls/657/comments"},"review_comment":{"href":"https://api.github.com/repos/toggl/superday/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/toggl/superday/pulls/657/commits"},"statuses":{"href":"https://api.github.com/repos/toggl/superday/statuses/cad5c9b21541d419adfa0fc1a31e748dbe05de65"}}}}
{"actor":{"display_login":"sofokli1"}}