{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/ui-date/issues/48","labels_url":"https://api.github.com/repos/angular-ui/ui-date/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-date/issues/48/comments","events_url":"https://api.github.com/repos/angular-ui/ui-date/issues/48/events","html_url":"https://github.com/angular-ui/ui-date/issues/48","id":22803717,"number":48,"title":"Prevent jquery datepicker formatDate exception","user":{"login":"candreoliveira","id":1408294,"avatar_url":"https://avatars.githubusercontent.com/u/1408294?v=3","gravatar_id":"","url":"https://api.github.com/users/candreoliveira","html_url":"https://github.com/candreoliveira","followers_url":"https://api.github.com/users/candreoliveira/followers","following_url":"https://api.github.com/users/candreoliveira/following{/other_user}","gists_url":"https://api.github.com/users/candreoliveira/gists{/gist_id}","starred_url":"https://api.github.com/users/candreoliveira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candreoliveira/subscriptions","organizations_url":"https://api.github.com/users/candreoliveira/orgs","repos_url":"https://api.github.com/users/candreoliveira/repos","events_url":"https://api.github.com/users/candreoliveira/events{/privacy}","received_events_url":"https://api.github.com/users/candreoliveira/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2013-11-17T20:02:56Z","updated_at":"2015-06-29T22:15:50Z","closed_at":null,"body":"In my point of view, you must catch the exception in your uiDateFormat directive to prevent the dowdy console error: \r\n\r\n```\r\nTypeError: Object 123 has no method 'getFullYear'\r\n```\r\n\r\nThe error occurs when you type a malformed string in the input where you apply the ui-date. \r\n\r\nYour directive try to execute (https://github.com/angular-ui/ui-date/blob/master/src/date.js#L99):\r\n\r\n```\r\njQuery.datepicker.formatDate(dateFormat, value);\r\n```\r\n\r\nBut I think you must execute:\r\n\r\n```\r\nmodelCtrl.$parsers.push(function(value){\r\n  try{\r\n    if (value)\r\n      return jQuery.datepicker.formatDate(dateFormat, value);                  \r\n  } catch(err) {}\r\n  return null;\r\n});\r\n```\r\n\r\nGive permission to PR"},"comment":{"url":"https://api.github.com/repos/angular-ui/ui-date/issues/comments/116862341","html_url":"https://github.com/angular-ui/ui-date/issues/48#issuecomment-116862341","issue_url":"https://api.github.com/repos/angular-ui/ui-date/issues/48","id":116862341,"user":{"login":"alexanderchan","id":1864372,"avatar_url":"https://avatars.githubusercontent.com/u/1864372?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderchan","html_url":"https://github.com/alexanderchan","followers_url":"https://api.github.com/users/alexanderchan/followers","following_url":"https://api.github.com/users/alexanderchan/following{/other_user}","gists_url":"https://api.github.com/users/alexanderchan/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderchan/subscriptions","organizations_url":"https://api.github.com/users/alexanderchan/orgs","repos_url":"https://api.github.com/users/alexanderchan/repos","events_url":"https://api.github.com/users/alexanderchan/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderchan/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T22:15:50Z","updated_at":"2015-06-29T22:15:50Z","body":"I think the way this directive validates and parses needs to be updated to use some of the features available since 1.3 and this will resolve many of the errors or invalid data getting propagated to the parsers/model."}}