mdb-date-picker-2 disable dates not in the array


Topic: mdb-date-picker-2 disable dates not in the array

ozgehan asked 2 months ago

Hi,

In datetime picker we have the option to disable dates which exist in array but i need to do opposite of that (disable the dates not in the array). I can do this by calculating dates but do we have an option or way to do this.

Thank you,


Mikołaj Smoleński staff commented 2 months ago

Limits option is an interesting feature and could be useful in your case. In limits you only set the available set of dates.

https://mdbootstrap.com/docs/vue/forms/date-picker/#date-limits https://vue.mdbootstrap.com/#/forms/pro/datepicker2

Best regards


ozgehan commented 2 months ago

I think limit is only used for disabling dates in date time picker. I have an array of available dates and trying to disable all of the other dates. I cant find any way to just set available dates to date picker in your links. My array is just like this ["2020-01-24","2020-02-02","2020-02-04"] and I just want these three dates to be available.

Thanks


Mikołaj Smoleński staff commented 2 months ago

It seems your only option is to prepare a reverse for your available dates.

Best regards


ozgehan commented 2 months ago

do you mean setting disabled dates rather than available dates by saying prepare a reverse?


Mikołaj Smoleński staff commented 2 months ago

Exactly. There are several ways of disabling dates in date picker, but we have not prepared the opposite features for enabling set of dates. Best regards


ozgehan commented 2 months ago

Actually in the other comment I mentioned I did the way you suggested but it is not effective(datetime picker freeze for 2-3 seconds depending on your array size when you change months). for making 3 dates available, you shouldn't make an array of apprx. 7.665 dates (btw. 2000-2021) and set it to mdb-date-picker.

Anyways thank you.


Mikołaj Smoleński staff commented 2 months ago

Thanks for your remarks. We'll consider making an option for enabling only available dates in the new DatePicker component. Best regards


ozgehan answered 2 months ago

I tried to set disabled dates by substracting it from a certain date range and setting it to disabled dates but it makes mdb-date-picker very slow. so calculating dates is not working efficiently


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: Vue
  • MDB Version: 6.7.2
  • Device: computer
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No