angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.29k stars 6.73k forks source link

'dateDisabled' validation error is pushed to the form and not the element #6331

Open shysank opened 7 years ago

shysank commented 7 years ago

The issues forum is NOT for support requests. It is for bugs and feature requests only. Please read https://github.com/angular-ui/bootstrap/blob/master/CONTRIBUTING.md and search existing issues (both open and closed) prior to opening any new issue and ensure you follow the instructions therein.

Bug description:

When a disabled date is chosen by typing in, the 'dateDisabled' validation error is triggered. However the validation error object is pushed to '$error' in the form and not the element. This makes it difficult to differentiate the errors if there are more than one datepickers.

Link to minimally-working plunker that reproduces the issue:

https://plnkr.co/edit/0XWmsZEo1BF3fU7NJgnA?p=preview

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.8

UIBS: 2.2.0

Bootstrap: 3.3.7

appienvanveen commented 7 years ago

+1

gpcaretti commented 7 years ago

file: datepicker.js line: 214

      ngModelCtrl.$setValidity('dateDisabled', !date ||
        this.element && !this.isDisabled(date));
MatthiasGwiozda commented 6 years ago

Any progress at this issue ?

andrefarzat commented 6 years ago

Any progress at this issue ?

benmccallum commented 6 years ago

Hey all,

I got super frustrated by how bad the validation was on this thing, so I rolled my own directive which seems to do the job, at least for my purposes. Just add valid-date to your input. See this gist for the code. Note, I use moment to compare the dates correctly.

Hope that helps some peeps.