xtianus79 / multiple-date-picker-angular

Multiple Date Picker for Angular: This includes Angular 2+ / 4+ / 5+ to utilize a lightweight and clean calendar allowing user to select multiple dates, single, use custom callback on (de)selection. You can also specify off days or already selected days. You can also select a range of dates with start and end inputs... This will also calculate all the days inbetween.
http://xtianus79.github.io/MultipleDatePicker
MIT License
14 stars 19 forks source link

calling dayClick clears all selected days #17

Open barrct opened 5 years ago

barrct commented 5 years ago

If I need an action to happen when a data is selected, confirmation, added detail, or to update a second instance's blackout dates, as soon as I add the function for [dayClick] it clears out all days on the calendar.

Now, if this is expected, I would say it's weird but I suspect that it should not wipe out all data. The below tweaks seems to allow the calendar to function in the way that I expected the [dayClick] trigger to work.

    if (typeof this.dayClick == 'function') {
        this.dayClick(event, day);
        /*
        if (!day.mdp.selected) {
            this.projectScope = [day.date];
            this.generate();
            this.dayClick(event, day);
        }
        else {
            this.clearDays();
            this.dayClick(event, day);
        }
        */
    }
xtianus79 commented 5 years ago

isn't the dayclick to just use a single day instead of multiple days?

barrct commented 3 years ago

Sorry, been on other projects. Isn't dayClick to use a single day? I'm not reading the parameter that way, I read the parameter as "when a DAY is CLICKED, notify some process" especially when the module is "multiple-date-picker". Examples:

barrct commented 3 years ago

btw, the above edit to allow the dayClick action to fire while maintaining the "multiple" aspect of the module is in /dist/multiple-date-picker.component.js line 121 of version 3.0.0

It is within the MultipleDatePickerComponent.prototype.toggleDay function