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

No possibility of using invalid values with Datepicker #6054

Open
pga23 opened this issue Jun 26, 2016 · 2 comments · May be fixed by #6519
Open

No possibility of using invalid values with Datepicker #6054

pga23 opened this issue Jun 26, 2016 · 2 comments · May be fixed by #6519

Comments

@pga23
Copy link

pga23 commented Jun 26, 2016

Bug description:

No possibility to set invalid Datepicker values (to display inside input field),
even if ng-model-options="{allowInvalid: true}".
As I suppose Timepicker bahaviour is the same.

If validation of entered value is so strict, should be easy possibility to override it.

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/ltjUZ8ZTGZS2T4YVI7YN?p=preview

After click of [SET: now-7d] button I'd like to see "now-7d" inside input field.
In one of previous version (eg. 0.14) it worked as expected.

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.7
UIBS: 1.3.3
Bootstrap: 3.3.6

@wesleycho
Copy link
Contributor

The allowInvalid setting is for changes started from a view, not from a model (see how Angular uses allowInvalid here: https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js). You would need to attach a custom directive and execute ngModel.$setViewValue(customValue).

As for adding baked in support from model changes, I'm leaning towards rejecting this request - IMO this is a perversion of what that option was created for in Angular. In addition, this likely would have unintended consequences with the datepicker and popup that could potentially break the datepicker.

I would be willing to potentially support a PR that adds support for this using a different option unique to the popup, but it also needs to be well-tested along with a reproduction in Plunker demonstrating it works properly.

@npbenjohnson
Copy link

npbenjohnson commented Apr 14, 2017

  1. User enters custom date string, saves form
  2. User reloads form, date string is hidden, although still in model (which means it can't be reviewed or corrected)

Seems like a very common use case that is completely broken right now, and allowInvalid on any standard form control would behave in a way that doesn't break it. Special-casing the setting, unless there is an unmanageable technical issue, seems like a strange choice.

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

Successfully merging a pull request may close this issue.

3 participants