[SOLVED] Disable Calendar

Can I disable calendar with two different range?
Example:

disabled: {
        from1: new Date().setDate(today.getDate() - xxx),
        to1: new Date().setDate(today.getDate() - 49),
        from2: today,
        to2: new Date().maxDate
    },
disabled: [
  {
    from: new Date().setDate(today.getDate() - xxx),
    to: new Date().setDate(today.getDate() - 49),
  },
  {
    from: today,
    to: new Date().maxDate
  }
],

I’m using minDate and maxDate

var calendarNormalBd = app.calendar.create({
                                   minDate: new Date(yearmin, month, day),
                                   maxDate: new Date(yearmax, month, day),
                                   inputEl: '.xxx',
                                   dateFormat: 'dd M yyyy',
                                   header: true,
                                   footer: true,

but there is some problem comes up, my calendar still focus on present date and I cann’t swipe calendar normaly, so how can I make calendar just focus on enable datetime?
Or how can I enable swipe to a disable year like in the picture below?

Pass value same as minDate

1 Like

How to do it programmatically. I have two calendars. The second calendar value should be one month less than first calendar. If I choose 16 March 2020 on 1st calendar then the 2nd calendar should show date upto 16 Feb 2020.

Do you also know how to add the following to it also:

   disabled(date) {
        return [ 0, 6 ].indexOf(date.getDay()) >= 0; 
   },

Adding it to the code below:

disabled: [
  {
    from: new Date().setDate(today.getDate() - xxx),
    to: new Date().setDate(today.getDate() - 49),
  },
  {
    from: today,
    to: new Date().maxDate
  }
],

I am trying so much but with no success. I hope you can help me?