restorando / angular-pickadate

A simple and fluid inline datepicker for AngularJS with no extra dependencies.
MIT License
273 stars 91 forks source link

Default date prevents other dates from being chosen #55

Open jmondo opened 9 years ago

jmondo commented 9 years ago

I added 2 test cases to the 'Default date" describe block:

it("the ngModel value can be set to some time inside the default month", function() {
  $scope.defaultDate = '2014-11-10';
  $scope.date        = '2014-11-01';
  compile();

  expect($scope.date).to.equal('2014-11-01');
});
// pass

it("the ngModel value can be set to some time outside the default month", function() {
  $scope.defaultDate = '2014-11-10';
  $scope.date        = '2014-03-01';
  compile();

  expect($scope.date).to.equal('2014-03-01');
});
// AssertionError: expected undefined to equal '2014-03-01'

The first case passes, the second case fails. Is that the intended behavior?

In our app, we set the default date to next month, but once we did that users were unable to choose dates in this month or 2 months from now. Halp?

gschammah commented 9 years ago

Hi there,

In the 2nd test, $scope.date should be 2014-03-01 and the displayed month should be November 2014. If that is not happening, then apparently we have a bug.

jmondo commented 9 years ago

It is displaying the correct month (and you have other tests for that). The problem I'm having is unrelated to the display of the calendar.

My problem: When you set a default month and then you choose a date outside that month $scope.date gets set to undefined.

gschammah commented 9 years ago

Ok, so then it's a bug that should be fixed. I will see if I have time to do it, but if you solved it, feel free to open a Pull Request

Thanks

jmondo commented 9 years ago

Haven't solved it yet. Will definitely open a PR if I can solve. Thanks!