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

minDate/maxDate not working when passed via datepicker-options #5315

Closed
luchsamapparat opened this issue Jan 20, 2016 · 3 comments
Closed

minDate/maxDate not working when passed via datepicker-options #5315

luchsamapparat opened this issue Jan 20, 2016 · 3 comments

Comments

@luchsamapparat
Copy link

When I use uib-datepicker-popup and pass minDate/maxDate as properties via datepicker-options I get this error:

[$parse:lexerr] Lexer Error: Unexpected next character  at columns 46-46 [ä] in expression [Wed Jan 20 2016 19:02:20 GMT+0100 (Mitteleuropäische Zeit)].

The problem is caused in this loop:

  angular.forEach(['minDate', 'maxDate'], function(key) {
    if ($attrs[key]) {
      watchListeners.push($scope.$parent.$watch($attrs[key], function(value) {
...
      }));
    } else {
...
    }
  });

When using the min-date/max-date attributes, $attrs[key] resolves to watchData.min/maxDate. When using the way described above, $attrs[key] is the actual Date instance passed via the options.

Here's a fiddle:

https://jsfiddle.net/qz34osvr/

@Foxandxss
Copy link
Contributor

I will check.

To be real honest, the datepicker <-> popup relationship is a bit ugly. There are some decisions made in there that are a bit weird.

We plan in revamping the whole datepicker and popup API to make it simple to use and remove all this options vs attributes thing.

In the meantime, this is an issue for sure.

@wesleycho wesleycho added this to the 1.1.1 milestone Jan 21, 2016
@wesleycho
Copy link
Contributor

Scheduling this for 1.1.1 - this will be the last critical fix (unless something else big comes up) before that release, hopefully for Monday morning or around that timeframe.

@luchsamapparat
Copy link
Author

Great, thanks!

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

No branches or pull requests

3 participants