bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Datepicker - Date is Always Required?

Open hancock808 opened this issue 11 years ago • 7 comments

See my Plunkr > http://plnkr.co/edit/1iGDEnnpEOtBPymPPiLS?p=preview

Dates are not required on my form, however when a date is entered then cleared out the form is marked invalid and the user cannot submit.

hancock808 avatar Jun 26 '15 15:06 hancock808

This looks like a legitimate bug - this needs to be rewritten to use ngModel.$validators

wesleycho avatar Jun 26 '15 19:06 wesleycho

@wesleycho , I have a fix to this bug in my forked repo: https://github.com/blendlabs/bootstrap. Should I add tests and submit a PR for this issue?

nivivive avatar Jul 22 '15 22:07 nivivive

I am assuming that this is the commit?

Feel free to open a PR - I think this is not quite the correct way to fix this though. The proper fix would change the setting of validity to be in ngModelCtrl.$validators.date and not manually checking $attrs.ngRequired.

wesleycho avatar Jul 22 '15 23:07 wesleycho

moving discussion to PR referenced below

nivivive avatar Jul 22 '15 23:07 nivivive

the bug still exists in version 1.3.2 (date is always required for uib-datepicker-popup component)

pavlovt avatar May 07 '16 11:05 pavlovt

Bug still exists in version 2.0.1. Is this project still maintained?

brunosantosnasajon avatar Oct 19 '17 11:10 brunosantosnasajon

Bug still happens on version 2.5.6.

I have an optional datepicker field initialized with null value. When the datepicker is initialized, angular has a $error.date

An null date is an invalid date, but a null value for the model maybe not.

MatheusArleson avatar Jan 26 '18 16:01 MatheusArleson