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

No possibility of using invalid values with Datepicker #6054

Open

Description

@pga23

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

Activity

  1. wesleycho commented on Jun 27, 2016

    @wesleycho
    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.

  2. npbenjohnson commented on Apr 14, 2017

    @npbenjohnson
    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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions