Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

input[type="datetime-local"], the $valid property not set to true on subsequent clearing with button #16500

Closed
@piotr-dobrogost

Description

@piotr-dobrogost

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"].

  1. Enter invalid date (only month for example)
    myForm.input.$valid == false
  2. Click clear button (blue cross icon)
    myForm.input.$valid == true
  3. Enter invalid date (only month for example)
    myForm.input.$valid == false
  4. Click clear button (blue cross icon)
    myForm.input.$valid == false <- should be true instead

AngularJS version: v1.6.10-build.25885+sha.c68b31c (current snapshot)
Browser: Chrome 65.0.3325.162
OS: Fedora 28

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions