Twipped / Kalendae

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

Blackout prevent new date select, but not date un-select #220

Closed bartolije closed 6 years ago

bartolije commented 6 years ago

If I choose to blackout an complete year, it seems I'm still able to un-select the current selected days. (but I can't enable them)

                var year = 2017;
                var calendar = new Kalendae({
                    startingYear: year,
                    attachTo: document.getElementById("calendr"),
                    months: 12,
                    viewStartDate: year + "/01/01",
                    endDate: year + "/12/31",
                    weekStart: 1,
                    direction: "futur",
                    mode: "multiple",
                    selected: selectedDays,
                    blackout: function () { return Kalendae.moment(year).format('y'); }
                });
Twipped commented 6 years ago

The blackout function works like an array filter, it passes the date as the first argument and you return true if you want the date blacked out, false if you don't. You're always returning a truthy value, so you're blacking out everything.

bartolije commented 6 years ago

Basically, that's what I need. But the fact is, while all is supposed to be blackout, I can still just 'uncheck' date that are already checked.

This part was supposed to be used as a "readonly" calendar, to show day of the year, but the user is able to click on selected day, which make them not-selected. (but he canno't check them again)

Twipped commented 6 years ago

Uh, yeah, Kalendae is a date picker, not a calendar widget. That's not a use case it's written for.