spongessuck / gm.datepickerMultiSelect

AngularJS module to extend UI Bootstrap's Datepicker directive to allow for multiple date selections.
MIT License
73 stars 41 forks source link

Add support to bootstrap 0.14 #29

Closed brenovieira closed 9 years ago

brenovieira commented 9 years ago
brenovieira commented 9 years ago

@spongessuck ,

As I commented on my new commit, Here is the history of datepicker.js on bootstrap github.

One of the lastest commits, they added three controllers to daypicker directive, as you can see here: Before and After

So, ctrl on

scope.$watch(function () {
    return ctrl.activeDate.getTime();
}, update);

is now actually an array of three controllers. Then ctrl.activeDate is undefined and ctrl.activeDate.getTime() throws an exception.

I needed to change it to

scope.$watch(function () {
    return angular.isArray(ctrls)
        ? ctrls[0].activeDate.getTime()
        : ctrls.activeDate.getTime();
}, update);

Note: I moved the test pages from root to test folder and forgot to change the path of modules\app.js and dist\gm.datepickerMultiSelect.min.js.

I forked your plunker and just change it to use bootstrap 0.14.1. You can see the exception on console: http://plnkr.co/edit/EzHmqn?p=preview

I don't like huge comments on the code, but I think it is kind of necessary in this case. What do you think ?

spongessuck commented 9 years ago

Sure, I think it looks great. Better too much info than not enough and it's not obvious what's going on.