Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically disabling dates with data from server as user interacts with calendar: Allow disable {from: -Infinity, to: Infinity} or Prevent cascading changes when set disable when the currently selected item object becomes disabled (for DATES) #1250

Open
davibertolini opened this issue Nov 8, 2023 · 0 comments

Comments

@davibertolini
Copy link

Dynamically disabling dates with data from server as user interacts with calendar: Allow disable {from: -Infinity, to: Infinity} or Prevent cascading changes when set disable when the currently selected item object becomes disabled (for DATES)

Our use case is the following:

I'm are obtaining data from a server every time the user is moving forward in months (listening to highlight event). In our case I am fetching the next 3 months from "today". When the user advances 2 months, I fetch the next 3 months.

The data obtained from the server is used to determine which dates in the future will be disabled. As soon as data is recovered, I disable the dates, which triggers cascading changes as per docs.

let a_closed_days = // array with dates obtained by the server
myPickadateCal.set('disable', a_closed_days);

There is a case where the data from the server will result in >3+ months dates disabled, since I'm just fetching 3 months, the calendar will change to the next enabled date, with is the first day of the 4th month.

But this is not accurate, since that day is also disabled (but the calendar does not "know" it since I just fetched data for 3 months).

I tried these solutions:

  • Setting max as the last disabled date: this is not a proper solution because max does not allow the user to continue moving forward in months
  • Disabling from the last date to Infinity: myPickadateCal.set.set('disable', [{from: dtLastDayClosed, to: Infinity}]); but Infinity is ignored, and does not disable anything.
  • Disabling from the last date to 10000 days in the future, but the calendar views changes to 10000 days in the future, which will be considered a weird behavior for the user.

But none seem to work. Maybe there will be no response as this project is seems to be deprecated in lieu of V5, but still worth the try. Willing to bounty this to the problem solver.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant