{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/12853","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/12853/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/12853/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/12853/events","html_url":"https://github.com/angular/angular.js/issues/12853","id":106425947,"number":12853,"title":"Error ng-invalid-date -      (Solutions in badInputChecker() )","user":{"login":"mxnho","id":14281916,"avatar_url":"https://avatars.githubusercontent.com/u/14281916?v=3","gravatar_id":"","url":"https://api.github.com/users/mxnho","html_url":"https://github.com/mxnho","followers_url":"https://api.github.com/users/mxnho/followers","following_url":"https://api.github.com/users/mxnho/following{/other_user}","gists_url":"https://api.github.com/users/mxnho/gists{/gist_id}","starred_url":"https://api.github.com/users/mxnho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mxnho/subscriptions","organizations_url":"https://api.github.com/users/mxnho/orgs","repos_url":"https://api.github.com/users/mxnho/repos","events_url":"https://api.github.com/users/mxnho/events{/privacy}","received_events_url":"https://api.github.com/users/mxnho/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-14T20:54:54Z","updated_at":"2016-06-08T08:06:13Z","closed_at":"2015-09-15T12:13:49Z","body":"I have a input type = \"Date\" not required in my form linked to a\r\nng - model = \"date\" , when I add a value to the component\r\nand then use the delete key to erase the value , the angular adds\r\nthe ng -invalid class component and adds to the value undefined , making my form\r\ninvalid.\r\n\r\n\r\nThe solution would be changing the function which adds badInputChecker undefined\r\n for the component , that function should be changed to set null instead of undefined.\r\nThus, the component will only be invalid if required .\r\n\r\nfunction badInputChecker(scope, element, attr, ctrl) {\r\n  var node = element[0];\r\n  var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);\r\n  if (nativeValidation) {\r\n    ctrl.$parsers.push(function(value) {\r\n      var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};\r\n      // Detect bug in FF35 for input[email] (https://bugzilla.mozilla.org/show_bug.cgi?id=1064430):\r\n      // - also sets validity.badInput (should only be validity.typeMismatch).\r\n      // - see http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#e-mail-state-(type=email)\r\n      // - can ignore this case as we can still read out the erroneous email...\r\n      //return validity.badInput && !validity.typeMismatch ? undefined: value;    old\r\n      return validity.badInput && !validity.typeMismatch ? null : value; //new\r\n    });\r\n  }\r\n}\r\n\r\n\r\nBest regards"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/224518170","html_url":"https://github.com/angular/angular.js/issues/12853#issuecomment-224518170","issue_url":"https://api.github.com/repos/angular/angular.js/issues/12853","id":224518170,"user":{"login":"kimx","id":5724118,"avatar_url":"https://avatars.githubusercontent.com/u/5724118?v=3","gravatar_id":"","url":"https://api.github.com/users/kimx","html_url":"https://github.com/kimx","followers_url":"https://api.github.com/users/kimx/followers","following_url":"https://api.github.com/users/kimx/following{/other_user}","gists_url":"https://api.github.com/users/kimx/gists{/gist_id}","starred_url":"https://api.github.com/users/kimx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimx/subscriptions","organizations_url":"https://api.github.com/users/kimx/orgs","repos_url":"https://api.github.com/users/kimx/repos","events_url":"https://api.github.com/users/kimx/events{/privacy}","received_events_url":"https://api.github.com/users/kimx/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T08:06:13Z","updated_at":"2016-06-08T08:06:13Z","body":"Hi @gkalpak \r\nI found another problem in Chrome.\r\n1.Key in Month or Date or Year.Dot not use choose.\r\n2.Use the \"X\" to clear the value -->Now $valid=true -->expect\r\n3.Key in Month or Date or Year again.\r\n4.Use the \"X\" to clear the value -->Now $valid=false -->error"}}
{"actor":{"display_login":"kimx"}}