{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ng-cordova/issues/885","labels_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/885/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/885/comments","events_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/885/events","html_url":"https://github.com/driftyco/ng-cordova/issues/885","id":95614029,"number":885,"title":"$cordovaDatePicker only returns first date","user":{"login":"joewoodhouse","id":3168135,"avatar_url":"https://avatars.githubusercontent.com/u/3168135?v=3","gravatar_id":"","url":"https://api.github.com/users/joewoodhouse","html_url":"https://github.com/joewoodhouse","followers_url":"https://api.github.com/users/joewoodhouse/followers","following_url":"https://api.github.com/users/joewoodhouse/following{/other_user}","gists_url":"https://api.github.com/users/joewoodhouse/gists{/gist_id}","starred_url":"https://api.github.com/users/joewoodhouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joewoodhouse/subscriptions","organizations_url":"https://api.github.com/users/joewoodhouse/orgs","repos_url":"https://api.github.com/users/joewoodhouse/repos","events_url":"https://api.github.com/users/joewoodhouse/events{/privacy}","received_events_url":"https://api.github.com/users/joewoodhouse/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-17T08:37:47Z","updated_at":"2015-08-02T00:11:15Z","closed_at":"2015-08-02T00:11:15Z","body":"With the latest version of the cordova-plugin-datepicker, when the datepicker appears the underlying plugin fires the `show` callback multiple times, each time the user changes the date, until the picker is dismissed.\r\n\r\nHowever because `$cordovaDatePicker` wraps the show callback in a promise, and a promise can only be resolved once, the result is that you only get notification of the first change of date, and not any subsequent ones.\r\n\r\nGiven the promise-y nature, I'm not sure what the solution is. Perhaps the promise `notify` could be called on each date change, with the promise being resolved with the final date value once the user has dismissed the picker.\r\n\r\nAs a workaround, for now I've just used the underlying $window.datePicker, e.g.\r\n\r\n```\r\n$window.datePicker(options,function(date){\r\n  // Gets called every time date changes\r\n  $timeout(function(){\r\n    // do something with date\r\n  });\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/driftyco/ng-cordova/issues/comments/126965646","html_url":"https://github.com/driftyco/ng-cordova/issues/885#issuecomment-126965646","issue_url":"https://api.github.com/repos/driftyco/ng-cordova/issues/885","id":126965646,"user":{"login":"gortok","id":699891,"avatar_url":"https://avatars.githubusercontent.com/u/699891?v=3","gravatar_id":"","url":"https://api.github.com/users/gortok","html_url":"https://github.com/gortok","followers_url":"https://api.github.com/users/gortok/followers","following_url":"https://api.github.com/users/gortok/following{/other_user}","gists_url":"https://api.github.com/users/gortok/gists{/gist_id}","starred_url":"https://api.github.com/users/gortok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gortok/subscriptions","organizations_url":"https://api.github.com/users/gortok/orgs","repos_url":"https://api.github.com/users/gortok/repos","events_url":"https://api.github.com/users/gortok/events{/privacy}","received_events_url":"https://api.github.com/users/gortok/received_events","type":"User","site_admin":false},"created_at":"2015-08-02T00:11:15Z","updated_at":"2015-08-02T00:11:15Z","body":"Using notify for this makes sense; if you'd like to put together a pull request, we'd be happy to accept.  \r\n\r\nI also had to do this for the custom plugin wrapper I wrote for the bluetoothle.js (not the ble.js that you know and love); that commit is here: https://github.com/Jewelbots/ng-cordova/commit/88463cb6b2adf09b052c362c5928b4d9223c2f1f\r\n\r\nI also wrote a more complex version of that so for another function here: \r\nhttps://github.com/Jewelbots/ng-cordova/commit/8fe7866eea4234d8e3d0442469ceac2ff95a46a0\r\n\r\nI'll close this; and submit a pull request for this issue and we'll handle it there.\r\n"}}