Twipped / Kalendae

A javascript date picker that just works.
MIT License
1.99k stars 285 forks source link

When `self._sel` is an empty array, `self.blackout()` always returns false #69

Closed aratak closed 11 years ago

aratak commented 11 years ago

I think, that blackout function should be without an empty array condition.

I can't understand why this condition was present, so could you explain why you validate length of _sel array.

        self.blackout = function (input) {
            input = moment(input).yearDay();
            if (input < 1 || !self._sel /* || self._sel.length < 1 */) return false;
            var i = bdates.length;
            while (i--) if (bdates[i].yearDay() === input) return true;
            return false;
        }

See an example on jsfiddle: http://jsfiddle.net/nMwEf/5/

Twipped commented 11 years ago

I must have had a reason for it, but I don't remember what it was. PR accepted