Yoorek
Yoorek

Reputation: 1003

Angular UI Bootstrap datepicker marks input $invalid after editing even it's correct

Standard date field with datepicker-popup from UI Bootstrap. Setting date programmatically - no problem. But after ANY change it is marked as $invalid and stays $invalid even format is correct and I edit it to previous value (which was correct in the beginning). Why?

<form name="form">
        <input name="testDatepicker"
               ng-model="testDatepicker"
               placeholder="dd-MM-yyyy"
               datepicker-popup="dd-MM-yyyy"/>

        <div style="color:red;font-weight:bold;"
             ng-show="form.testDatepicker.$dirty && form.testDatepicker.$invalid">
           Invalid date
        </div>
</form>

JSFiddle: http://jsfiddle.net/yoorek/mug2e381/

Upvotes: 1

Views: 1683

Answers (2)

Vipul Agarwal
Vipul Agarwal

Reputation: 1611

Upgrade the version to the latest one. It has at least been resolved in version 0.14.3.

Upvotes: 0

Yoorek
Yoorek

Reputation: 1003

Apparently there is a bug in UI Bootstrap: https://github.com/angular-ui/bootstrap/issues/3835

Upvotes: 1

Related Questions