{"action":"created","comment":{"url":"https://api.github.com/repos/a2ui/a2ui/pulls/comments/78945176","id":78945176,"diff_hunk":"@@ -0,0 +1,114 @@\n+import * as ng from \"@angular/core\";\n+import * as c from \"@angular/forms\";\n+import {DateFormatter} from \"./date-formatter\";\n+import {DateDecorator} from \"./date-picker-container.component\";\n+\n+const DATE_RANGE_PICKER_VALUE_ACCESSOR: any = {\n+    provide: c.NG_VALUE_ACCESSOR,\n+    useExisting: ng.forwardRef(() => DateRangePickerComponent),\n+    multi: true\n+};\n+\n+@ng.Component({\n+    selector: \"date-range-picker\",\n+    templateUrl: \"/src/bootstrap/datepicker/date-range-picker.component.html\",\n+    providers: [DATE_RANGE_PICKER_VALUE_ACCESSOR]\n+})\n+export class DateRangePickerComponent implements c.ControlValueAccessor {\n+\n+    @ng.Input(\"showWeeks\") showWeeks: boolean;\n+    @ng.Input() minDate: Date;\n+    @ng.Input() maxDate: Date;\n+\n+    @ng.Output(\"close\") close: ng.EventEmitter<Date> = new ng.EventEmitter<Date>();\n+\n+    private startDate: Date;\n+    private endDate: Date;\n+    private isValid: boolean;\n+\n+    onChange = (_: any) => {\n+    };\n+\n+    onTouched = () => {\n+    };\n+\n+    writeValue (value: any): void {\n+        if (value) {\n+            if (value instanceof Date) {\n+                this.startDate = value;\n+            } else {\n+                let parts: string[] = value.split(\" - \");\n+                this.startDate = parts[0] ? DateFormatter.parse(parts[0]) : new Date();\n+                this.endDate = parts[1] ? DateFormatter.parse(parts[1]) : new Date();\n+            }\n+        }\n+    }\n+\n+    toDateRange (format ?: string): string {\n+        let result: string = \"\";\n+        if (this.startDate !== undefined && this.startDate !== null) {\n+            result += DateFormatter.format(this.startDate, format ? format : \"yyyy-MM-dd\");\n+        }\n+        if (this.endDate !== undefined && this.endDate !== null) {\n+            if (result.length > 0) {\n+                result += \" - \";\n+            }\n+            result += DateFormatter.format(this.endDate, format ? format : \"yyyy-MM-dd\");\n+        }\n+        return result;\n+    }\n+\n+    registerOnChange (fn: any): void {\n+        this.onChange = fn;\n+    }\n+\n+    registerOnTouched (fn: any): void {\n+        this.onTouched = fn;\n+    }\n+\n+    static isDateLater (first: Date, second: Date): boolean {\n+        if (first && second) {\n+            return first.getTime() > second.getTime();\n+        }\n+        return true;","path":"src/bootstrap/datepicker/date-range-picker.component.ts","position":73,"original_position":73,"commit_id":"12715e9e31500f12dae51e780008955cd027c844","original_commit_id":"7424b0ee0b62bd18bd2f20e22383003778d006f9","user":{"login":"pfijalki","id":13567322,"avatar_url":"https://avatars.githubusercontent.com/u/13567322?v=3","gravatar_id":"","url":"https://api.github.com/users/pfijalki","html_url":"https://github.com/pfijalki","followers_url":"https://api.github.com/users/pfijalki/followers","following_url":"https://api.github.com/users/pfijalki/following{/other_user}","gists_url":"https://api.github.com/users/pfijalki/gists{/gist_id}","starred_url":"https://api.github.com/users/pfijalki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfijalki/subscriptions","organizations_url":"https://api.github.com/users/pfijalki/orgs","repos_url":"https://api.github.com/users/pfijalki/repos","events_url":"https://api.github.com/users/pfijalki/events{/privacy}","received_events_url":"https://api.github.com/users/pfijalki/received_events","type":"User","site_admin":false},"body":"I don't get why this function returns true for undefined dates","created_at":"2016-09-15T11:47:27Z","updated_at":"2016-09-15T11:58:44Z","html_url":"https://github.com/a2ui/a2ui/pull/2#discussion_r78945176","pull_request_url":"https://api.github.com/repos/a2ui/a2ui/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/a2ui/a2ui/pulls/comments/78945176"},"html":{"href":"https://github.com/a2ui/a2ui/pull/2#discussion_r78945176"},"pull_request":{"href":"https://api.github.com/repos/a2ui/a2ui/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/a2ui/a2ui/pulls/2","id":85180701,"html_url":"https://github.com/a2ui/a2ui/pull/2","diff_url":"https://github.com/a2ui/a2ui/pull/2.diff","patch_url":"https://github.com/a2ui/a2ui/pull/2.patch","issue_url":"https://api.github.com/repos/a2ui/a2ui/issues/2","number":2,"state":"open","locked":false,"title":"Add datepicker","user":{"login":"Zarysiek","id":3034624,"avatar_url":"https://avatars.githubusercontent.com/u/3034624?v=3","gravatar_id":"","url":"https://api.github.com/users/Zarysiek","html_url":"https://github.com/Zarysiek","followers_url":"https://api.github.com/users/Zarysiek/followers","following_url":"https://api.github.com/users/Zarysiek/following{/other_user}","gists_url":"https://api.github.com/users/Zarysiek/gists{/gist_id}","starred_url":"https://api.github.com/users/Zarysiek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zarysiek/subscriptions","organizations_url":"https://api.github.com/users/Zarysiek/orgs","repos_url":"https://api.github.com/users/Zarysiek/repos","events_url":"https://api.github.com/users/Zarysiek/events{/privacy}","received_events_url":"https://api.github.com/users/Zarysiek/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-14T07:45:51Z","updated_at":"2016-09-15T11:58:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a63885eb544f38574b20d1b657bfc86a5f094fe","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/a2ui/a2ui/pulls/2/commits","review_comments_url":"https://api.github.com/repos/a2ui/a2ui/pulls/2/comments","review_comment_url":"https://api.github.com/repos/a2ui/a2ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/a2ui/a2ui/issues/2/comments","statuses_url":"https://api.github.com/repos/a2ui/a2ui/statuses/12715e9e31500f12dae51e780008955cd027c844","head":{"label":"Zarysiek:master","ref":"master","sha":"12715e9e31500f12dae51e780008955cd027c844","user":{"login":"Zarysiek","id":3034624,"avatar_url":"https://avatars.githubusercontent.com/u/3034624?v=3","gravatar_id":"","url":"https://api.github.com/users/Zarysiek","html_url":"https://github.com/Zarysiek","followers_url":"https://api.github.com/users/Zarysiek/followers","following_url":"https://api.github.com/users/Zarysiek/following{/other_user}","gists_url":"https://api.github.com/users/Zarysiek/gists{/gist_id}","starred_url":"https://api.github.com/users/Zarysiek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zarysiek/subscriptions","organizations_url":"https://api.github.com/users/Zarysiek/orgs","repos_url":"https://api.github.com/users/Zarysiek/repos","events_url":"https://api.github.com/users/Zarysiek/events{/privacy}","received_events_url":"https://api.github.com/users/Zarysiek/received_events","type":"User","site_admin":false},"repo":{"id":68100384,"name":"a2ui-1","full_name":"Zarysiek/a2ui-1","owner":{"login":"Zarysiek","id":3034624,"avatar_url":"https://avatars.githubusercontent.com/u/3034624?v=3","gravatar_id":"","url":"https://api.github.com/users/Zarysiek","html_url":"https://github.com/Zarysiek","followers_url":"https://api.github.com/users/Zarysiek/followers","following_url":"https://api.github.com/users/Zarysiek/following{/other_user}","gists_url":"https://api.github.com/users/Zarysiek/gists{/gist_id}","starred_url":"https://api.github.com/users/Zarysiek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zarysiek/subscriptions","organizations_url":"https://api.github.com/users/Zarysiek/orgs","repos_url":"https://api.github.com/users/Zarysiek/repos","events_url":"https://api.github.com/users/Zarysiek/events{/privacy}","received_events_url":"https://api.github.com/users/Zarysiek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Zarysiek/a2ui-1","description":"Angular 2 Components http://www.a2ui.com","fork":true,"url":"https://api.github.com/repos/Zarysiek/a2ui-1","forks_url":"https://api.github.com/repos/Zarysiek/a2ui-1/forks","keys_url":"https://api.github.com/repos/Zarysiek/a2ui-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Zarysiek/a2ui-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Zarysiek/a2ui-1/teams","hooks_url":"https://api.github.com/repos/Zarysiek/a2ui-1/hooks","issue_events_url":"https://api.github.com/repos/Zarysiek/a2ui-1/issues/events{/number}","events_url":"https://api.github.com/repos/Zarysiek/a2ui-1/events","assignees_url":"https://api.github.com/repos/Zarysiek/a2ui-1/assignees{/user}","branches_url":"https://api.github.com/repos/Zarysiek/a2ui-1/branches{/branch}","tags_url":"https://api.github.com/repos/Zarysiek/a2ui-1/tags","blobs_url":"https://api.github.com/repos/Zarysiek/a2ui-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Zarysiek/a2ui-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Zarysiek/a2ui-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/Zarysiek/a2ui-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Zarysiek/a2ui-1/statuses/{sha}","languages_url":"https://api.github.com/repos/Zarysiek/a2ui-1/languages","stargazers_url":"https://api.github.com/repos/Zarysiek/a2ui-1/stargazers","contributors_url":"https://api.github.com/repos/Zarysiek/a2ui-1/contributors","subscribers_url":"https://api.github.com/repos/Zarysiek/a2ui-1/subscribers","subscription_url":"https://api.github.com/repos/Zarysiek/a2ui-1/subscription","commits_url":"https://api.github.com/repos/Zarysiek/a2ui-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/Zarysiek/a2ui-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/Zarysiek/a2ui-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/Zarysiek/a2ui-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/Zarysiek/a2ui-1/contents/{+path}","compare_url":"https://api.github.com/repos/Zarysiek/a2ui-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Zarysiek/a2ui-1/merges","archive_url":"https://api.github.com/repos/Zarysiek/a2ui-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Zarysiek/a2ui-1/downloads","issues_url":"https://api.github.com/repos/Zarysiek/a2ui-1/issues{/number}","pulls_url":"https://api.github.com/repos/Zarysiek/a2ui-1/pulls{/number}","milestones_url":"https://api.github.com/repos/Zarysiek/a2ui-1/milestones{/number}","notifications_url":"https://api.github.com/repos/Zarysiek/a2ui-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Zarysiek/a2ui-1/labels{/name}","releases_url":"https://api.github.com/repos/Zarysiek/a2ui-1/releases{/id}","deployments_url":"https://api.github.com/repos/Zarysiek/a2ui-1/deployments","created_at":"2016-09-13T10:56:49Z","updated_at":"2016-09-13T10:56:50Z","pushed_at":"2016-09-15T11:53:34Z","git_url":"git://github.com/Zarysiek/a2ui-1.git","ssh_url":"git@github.com:Zarysiek/a2ui-1.git","clone_url":"https://github.com/Zarysiek/a2ui-1.git","svn_url":"https://github.com/Zarysiek/a2ui-1","homepage":null,"size":911,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":"a2ui:master","ref":"master","sha":"d29df18a705e335b348f11521a3d23255d9d31ed","user":{"login":"a2ui","id":22136387,"avatar_url":"https://avatars.githubusercontent.com/u/22136387?v=3","gravatar_id":"","url":"https://api.github.com/users/a2ui","html_url":"https://github.com/a2ui","followers_url":"https://api.github.com/users/a2ui/followers","following_url":"https://api.github.com/users/a2ui/following{/other_user}","gists_url":"https://api.github.com/users/a2ui/gists{/gist_id}","starred_url":"https://api.github.com/users/a2ui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a2ui/subscriptions","organizations_url":"https://api.github.com/users/a2ui/orgs","repos_url":"https://api.github.com/users/a2ui/repos","events_url":"https://api.github.com/users/a2ui/events{/privacy}","received_events_url":"https://api.github.com/users/a2ui/received_events","type":"User","site_admin":false},"repo":{"id":67953020,"name":"a2ui","full_name":"a2ui/a2ui","owner":{"login":"a2ui","id":22136387,"avatar_url":"https://avatars.githubusercontent.com/u/22136387?v=3","gravatar_id":"","url":"https://api.github.com/users/a2ui","html_url":"https://github.com/a2ui","followers_url":"https://api.github.com/users/a2ui/followers","following_url":"https://api.github.com/users/a2ui/following{/other_user}","gists_url":"https://api.github.com/users/a2ui/gists{/gist_id}","starred_url":"https://api.github.com/users/a2ui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a2ui/subscriptions","organizations_url":"https://api.github.com/users/a2ui/orgs","repos_url":"https://api.github.com/users/a2ui/repos","events_url":"https://api.github.com/users/a2ui/events{/privacy}","received_events_url":"https://api.github.com/users/a2ui/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/a2ui/a2ui","description":"Angular 2 Components http://www.a2ui.com","fork":false,"url":"https://api.github.com/repos/a2ui/a2ui","forks_url":"https://api.github.com/repos/a2ui/a2ui/forks","keys_url":"https://api.github.com/repos/a2ui/a2ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/a2ui/a2ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/a2ui/a2ui/teams","hooks_url":"https://api.github.com/repos/a2ui/a2ui/hooks","issue_events_url":"https://api.github.com/repos/a2ui/a2ui/issues/events{/number}","events_url":"https://api.github.com/repos/a2ui/a2ui/events","assignees_url":"https://api.github.com/repos/a2ui/a2ui/assignees{/user}","branches_url":"https://api.github.com/repos/a2ui/a2ui/branches{/branch}","tags_url":"https://api.github.com/repos/a2ui/a2ui/tags","blobs_url":"https://api.github.com/repos/a2ui/a2ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/a2ui/a2ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/a2ui/a2ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/a2ui/a2ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/a2ui/a2ui/statuses/{sha}","languages_url":"https://api.github.com/repos/a2ui/a2ui/languages","stargazers_url":"https://api.github.com/repos/a2ui/a2ui/stargazers","contributors_url":"https://api.github.com/repos/a2ui/a2ui/contributors","subscribers_url":"https://api.github.com/repos/a2ui/a2ui/subscribers","subscription_url":"https://api.github.com/repos/a2ui/a2ui/subscription","commits_url":"https://api.github.com/repos/a2ui/a2ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/a2ui/a2ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/a2ui/a2ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/a2ui/a2ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/a2ui/a2ui/contents/{+path}","compare_url":"https://api.github.com/repos/a2ui/a2ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/a2ui/a2ui/merges","archive_url":"https://api.github.com/repos/a2ui/a2ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/a2ui/a2ui/downloads","issues_url":"https://api.github.com/repos/a2ui/a2ui/issues{/number}","pulls_url":"https://api.github.com/repos/a2ui/a2ui/pulls{/number}","milestones_url":"https://api.github.com/repos/a2ui/a2ui/milestones{/number}","notifications_url":"https://api.github.com/repos/a2ui/a2ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/a2ui/a2ui/labels{/name}","releases_url":"https://api.github.com/repos/a2ui/a2ui/releases{/id}","deployments_url":"https://api.github.com/repos/a2ui/a2ui/deployments","created_at":"2016-09-11T20:36:39Z","updated_at":"2016-09-11T20:47:39Z","pushed_at":"2016-09-15T11:53:35Z","git_url":"git://github.com/a2ui/a2ui.git","ssh_url":"git@github.com:a2ui/a2ui.git","clone_url":"https://github.com/a2ui/a2ui.git","svn_url":"https://github.com/a2ui/a2ui","homepage":null,"size":892,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/a2ui/a2ui/pulls/2"},"html":{"href":"https://github.com/a2ui/a2ui/pull/2"},"issue":{"href":"https://api.github.com/repos/a2ui/a2ui/issues/2"},"comments":{"href":"https://api.github.com/repos/a2ui/a2ui/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/a2ui/a2ui/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/a2ui/a2ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/a2ui/a2ui/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/a2ui/a2ui/statuses/12715e9e31500f12dae51e780008955cd027c844"}}}}
{"actor":{"display_login":"pfijalki"}}