ion2-calendar icon indicating copy to clipboard operation
ion2-calendar copied to clipboard

Not able to disable dates dynamically.

Open Nayank9 opened this issue 3 years ago • 1 comments

Ionic version: (check one with "x") [ ] 2.x [ ] 3.x [x ] 4.x

Ion2-calendar mode: (check one with "x") [ ] components mode [x ] modal mode

I'm submitting a ... (check one with "x") [ ] bug report [ ] feature request [x ] help me

Current behavior:

I'm trying to disable some dates dynamically but it's not working, it is disabling dates only when we set disable dates at the time of variable initialisation. -----------Following is Working---------------- options: CalendarModalOptions = { daysConfig: [ { date: new Date(2021, 3, 12), disable: true, }, { date: new Date(2021, 3, 15), disable: true, } ] }; -----------Not Working--------------- this.options.daysConfig = [{ date: new Date(2021, 3, 12), disable: true, }, { date: new Date(2021, 3, 15), disable: true, }];

Expected behavior:

Steps to reproduce:

Related code:

insert short code snippets here

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here

Nayank9 avatar Apr 10 '21 07:04 Nayank9

You can try to replace whole options, works for me, smth like -

this.options = {
    ...this.options,
    daysConfig:  [{
        date: new Date(2021, 3, 12),
        disable: true,
    }, {
        date: new Date(2021, 3, 15),
        disable: true,
    }],
};

F-E-N-R-I-R avatar Apr 14 '21 13:04 F-E-N-R-I-R