input[type="datetime-local"], the $valid property not set to true on subsequent clearing with button #16500
Description
I'm submitting a ...
- [x ] bug report
Current behavior:
When using input[type="datetime-local"]
directive without required
attribute then clearing input with clear button (blue cross icon) sets $valid
property to true
only the first time the button is clicked. Subsequent clicks do not set the property to true
value anymore.
Expected / new behavior:
Clicking clear button of a control for non-required input[type="datetime-local"]
directive should always set $valid
property to true
.
Minimal reproduction of the problem with instructions:
https://plnkr.co/edit/eFypeLyTVuBi394KhKwR?p=preview
This is version of plunkr from the docs https://docs.angularjs.org/api/ng/input/input%5Bdatetime-local%5D with two modifications: initial Date object is null and attribute required
is removed from input[type="datetime-local"]
.
- Enter invalid date (only month for example)
myForm.input.$valid == false
- Click clear button (blue cross icon)
myForm.input.$valid == true
- Enter invalid date (only month for example)
myForm.input.$valid == false
- Click clear button (blue cross icon)
myForm.input.$valid == false
<- should betrue
instead
AngularJS version: v1.6.10-build.25885+sha.c68b31c (current snapshot)
Browser: Chrome 65.0.3325.162
OS: Fedora 28