Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Inline-Datepicker doesn't add ng-(in)?valid #1688

Closed
Crisfole opened this issue Jan 28, 2014 · 39 comments
Closed

Inline-Datepicker doesn't add ng-(in)?valid #1688

Crisfole opened this issue Jan 28, 2014 · 39 comments

Comments

@Crisfole
Copy link

The inline datepicker allows typing in an invalid (disabled) date, and doesn't add the ng-invalid class to the datepicker.

It seems that the dropdown itself is modified to include the ng-invalid but not the actual input...Am I misunderstanding something?

@fischermatte
Copy link

+1. it actually works when using inline datepicker, but not with popup on an input element. one can easily reproduce it in the showcase.

@SeraphicRav
Copy link

+1

11 similar comments
@wleelavivat
Copy link

+1

@pavax
Copy link

pavax commented Jun 18, 2014

+1

@boroth
Copy link

boroth commented Jun 24, 2014

+1

@adosaiguas
Copy link

+1

@roonel
Copy link

roonel commented Aug 7, 2014

+1

@aberkecz
Copy link

aberkecz commented Aug 7, 2014

+1

@jaroslavrehorka
Copy link

+1

@gjspaho
Copy link

gjspaho commented Sep 10, 2014

+1

@VictorRicha
Copy link

+1

@clicktravel-martin
Copy link

+1

@kudmni
Copy link

kudmni commented Sep 22, 2014

+1

@edim24
Copy link

edim24 commented Sep 22, 2014

++

@raftheunis87
Copy link

+1

1 similar comment
@alexyuryev
Copy link

+1

@DumboJet
Copy link

DumboJet commented Oct 6, 2014

+10 // Just to break the tradition! :D

@videege
Copy link

videege commented Oct 24, 2014

+1

@Crisfole
Copy link
Author

I'd like to take this moment to thank my fans, my parents, and all of you for this amazing response and outpouring. Never before has one of my issues been so popularly 👍'd before.

@ovaris
Copy link

ovaris commented Nov 3, 2014

+1

@ovaris
Copy link

ovaris commented Nov 24, 2014

@Crisfole please check PR #2901

@Crisfole
Copy link
Author

@ovaris Unfortunately because I have corporate clients that refuse to update beyond IE8 I had to give up Angular. No sense building a site that could never receive updates to the core framework, especially if those updates are security related...

@ovaris
Copy link

ovaris commented Nov 28, 2014

@Crisfole so are you saying that Angular UI is NOT going to be Angular 1.3 compatible, at least not in the near future?

@antoinepairet
Copy link

@ovaris see the updated README, we are working on angular 1.3 compatibility

@Crisfole
Copy link
Author

@ovaris: I'm not part of the team. I have exactly zero say in the angular-ui's compatibility :)

@karianna
Copy link
Contributor

@kipusoep
Copy link

+1

1 similar comment
@benjaminch
Copy link

+1

@chrisirhc
Copy link
Contributor

Related work: #3020

Please don't +1, we already know this is a priority.

@estvmachine
Copy link

What alternative solution exists for this issue?, if i want a datepicker with validation of min and max. Thanks for the response in advance.

@erdebee
Copy link

erdebee commented Jul 5, 2015

Create a custom directive to do the validation for you, if you really need it.. Until a fix is available.

Here is a blogpost describing such a directive.

https://rashimuddin.wordpress.com/2014/08/24/date-range-custom-validation-in-angular-js/

@ComeOutToPlay
Copy link

@narangrishab
Copy link

Hello Guys, How to do start date end date validation using Angular JS for bootstrap datepicker?

@wesleycho
Copy link
Contributor

I believe this is fixed currently, as the homepage works as expected.

@narangrishab: take a look at the documentation for the datepicker, and read up on how validation in Angular works.

Closing as fixed.

@dylaninvodo
Copy link

As of September 15th, 2015 the datepicker-popup example at https://angular-ui.github.io/bootstrap/ is not correctly setting the error classes on the input element when a date is manually entered that is before the min-date value.

Screenshot:
screen shot 2015-09-15 at 2 09 27 pm

@cen1
Copy link

cen1 commented Oct 20, 2015

Yep, seems broken to me. Invalid not set on the text input.

@icfantv
Copy link
Contributor

icfantv commented Oct 21, 2015

@dylaninvodo or @cen1, please open a new issue rather than piling on to an existing and unrelated issue that is already closed. Doing so is a really good way to not get the issue fixed as we will most likely miss it.

If you so boldly dare to venture where many have gone before and want to file a new issue, please follow the instructions here. Thanks.

@icfantv
Copy link
Contributor

icfantv commented Oct 21, 2015

Oh for pete's sake. Nevermind. I just saw your issue. I'll shut up now.

@humam-nameer-10p
Copy link

As an alternative to include range in date entered, I worked with UI.validate and it worked fine!

include dependency => 'ui.validate'
In html
<input type="text" name="dob" show-button-bar="false" class="tw-formControl" uib-datepicker-popup="MM/dd/yyyy" ng-model="vm.profile.attributes.dob" ui-validate="{outOfBounds : 'vm.checkDateLimits($value)' }" is-open="vm.calanderToggle" placeholder="mm/dd/yyyy" datepicker-options="dateOptions"/>

validations:

<div class="tw-customValidation" ng-messages="profileForm.dob.$error" ng-if="profileForm.dob.$dirty || profileForm.$submitted"> <div ng-message="date">Please enter a valid date</div> <div ng-message="outOfBounds"> Date selected is out of range. </div> </div>

In Controller:

  vm.checkDateLimits = function(selectedDate){
        var currentDate = new Date(selectedDate);
        var upperBounds = new Date();
        var lowerBounds = new Date('01/01/1900');

    return currentDate < upperBounds && currentDate > lowerBounds;

  }

documentation for ui.validate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.