{"action":"created","issue":{"url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/754","repository_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap","labels_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/754/labels{/name}","comments_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/754/comments","events_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/754/events","html_url":"https://github.com/ng-bootstrap/ng-bootstrap/issues/754","id":177566867,"number":754,"title":"NgbDate culture format and initial model?","user":{"login":"asadsahi","id":3470892,"avatar_url":"https://avatars2.githubusercontent.com/u/3470892?v=4","gravatar_id":"","url":"https://api.github.com/users/asadsahi","html_url":"https://github.com/asadsahi","followers_url":"https://api.github.com/users/asadsahi/followers","following_url":"https://api.github.com/users/asadsahi/following{/other_user}","gists_url":"https://api.github.com/users/asadsahi/gists{/gist_id}","starred_url":"https://api.github.com/users/asadsahi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asadsahi/subscriptions","organizations_url":"https://api.github.com/users/asadsahi/orgs","repos_url":"https://api.github.com/users/asadsahi/repos","events_url":"https://api.github.com/users/asadsahi/events{/privacy}","received_events_url":"https://api.github.com/users/asadsahi/received_events","type":"User","site_admin":false},"labels":[{"id":263376143,"url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/labels/component:%20datepicker","name":"component: datepicker","color":"ffffff","default":false},{"id":260885728,"url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/labels/type:%20feature","name":"type: feature","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2016-09-17T09:46:49Z","updated_at":"2017-09-09T08:43:13Z","closed_at":null,"author_association":"NONE","body":"Two questions as I cannot find details anywhere:\n\n1) how can I enforce NgbDate to follow dateformat like 'dd/MM/yyyy'.\n2) I set initial model to empty string or '2016-12-10', both ended up in this initial date:\n\n![image](https://cloud.githubusercontent.com/assets/3470892/18607423/c8e06582-7cc3-11e6-8de1-f1fe507d8c74.png)\n\nHow I can set the initial date based on a certain set format, e.g in my case its en-gb culture?\n\nThanks\n"},"comment":{"url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/comments/328263795","html_url":"https://github.com/ng-bootstrap/ng-bootstrap/issues/754#issuecomment-328263795","issue_url":"https://api.github.com/repos/ng-bootstrap/ng-bootstrap/issues/754","id":328263795,"user":{"login":"GeorgeKagan","id":3491404,"avatar_url":"https://avatars2.githubusercontent.com/u/3491404?v=4","gravatar_id":"","url":"https://api.github.com/users/GeorgeKagan","html_url":"https://github.com/GeorgeKagan","followers_url":"https://api.github.com/users/GeorgeKagan/followers","following_url":"https://api.github.com/users/GeorgeKagan/following{/other_user}","gists_url":"https://api.github.com/users/GeorgeKagan/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgeKagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgeKagan/subscriptions","organizations_url":"https://api.github.com/users/GeorgeKagan/orgs","repos_url":"https://api.github.com/users/GeorgeKagan/repos","events_url":"https://api.github.com/users/GeorgeKagan/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgeKagan/received_events","type":"User","site_admin":false},"created_at":"2017-09-09T08:43:13Z","updated_at":"2017-09-09T08:43:13Z","author_association":"NONE","body":"The problem I had was pre-filling using reactive forms.\r\nIf it helps anyone what I did eventually was using ngModel in conjunction with formControlName:\r\n`<input ngbDatepicker formControlName=\"startDate\" [(ngModel)]=\"initialStartDate\">`\r\n\r\nIn the model:  \r\n`this.startDate[0] = data.start_date; // in string format as received from DB`\r\n\r\nIn the component, converting string date into `NgbDateStruct`:\r\n```\r\n// Edit mode - workaround for pre-filling the date input\r\nif (this.milestones.controls['startDate'].value) {\r\n  let parts = this.milestones.controls['startDate'].value.split('-');\r\n  this.initialStartDate = {\r\n    year: parseInt(parts[0]), \r\n    month: parseInt(parts[1]), \r\n    day: parseInt(parts[2])\r\n  };\r\n}\r\n```"}}
{"actor":{"display_login":"GeorgeKagan"}}