disabledDateRanges @ 18 Feb 2022

I just follow the example here and I find that this function is not working for me.

https://www.wix.com/velo/reference/$w/datepicker/disableddateranges

const roster = [
2  {
3    startDate: new Date('1/1/2022'),
4    endDate: new Date('1/31/2022')
5  },
6  {
7    startDate: new Date('4/01/2022'),
8    endDate: new Date('4/30/2022')
9  },
10  {
11    startDate: new Date('7/01/2022'),
12    endDate: new Date('7/31/2022')
13  },
14  {
15    startDate: new Date('10/01/2022'),
16    endDate: new Date('10/31/2022')
17  }
18];
19
20const holidays2022 = [
21  {
22    startDate: new Date('4/15/2022'),
23    endDate: new Date('4/17/2022')
24  },
25  {
26    startDate: new Date('12/25/2022'),
27    endDate: new Date('01/01/2023')
28  }
29];
30
31$w('#myDatePicker').enabledDateRanges = roster;        // Available on 1st month of each quarter   
32$w('#myDatePicker').disabledDateRanges = holidays2022; // Not available on holidays
33$w('#myDatePicker').disabledDaysOfWeek = [0, 6];       // Not available on weekends

I put the above code from the exmaple in my website within the $w.onReady(function () {}, and I find that “enabledDateRanges” and “disabledDateRanges” are not working. Only this function “disabledDaysOfWeek” is working. I have also tried “maxDate” is working. Does anyone encounter the same issue like me?

I can choose 15 Apr which is not expected.

Also May should not be selected as expected as well.

Hi,

Quick question.

did you try this in preview only?
I tried in preview and on live and in the preview it is like you say, the holidays won’t be disabled,
But if i go to the live website it seems to work fine.

Kind regards,
kristof.

yes i only tried in preview mode. let me try it on live.
but i think the document should mark down which function is for on live only… I have seen there were some functions also only worked on live but not preview mode.

Thanks Kristof