Need a special offer?Find out if your project fits.
+

set calendar component's max / min date

Answered
Menachem asked on April 21, 2024

i'm trying to disable future / earlier than 3 years date selections for the date fields filters.
is there any way i can achieve that?

something like:

"timestamp": {
"type": "date string",
"mindate": DATE,
"maxdate": DATE
}

Thanks.

4 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster April 22, 2024

Hello, Menachem!

Thank you for reaching out to us.

Kindly note that Flexmonster does not support disabling the selection of certain members from the filter UI. However, a similar result in limiting the date selection can be achieved by prefiltering the data before passing it to the component. This functionality can be implemented for the custom API data source by adding the date limit parameters to the customizeAPIRequest function. This way, you could send min and max dates to the custom API server and filter the data before returning it to the client. 
We have prepared a JSFiddle example to illustrate the idea: https://jsfiddle.net/flexmonster/94kthagx/

Please let us know if such an approach would work for you.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster 4 days ago

Hello, Menachem!

Hope you are doing well.
We are wondering if you had time to test the suggested approach for restricting the date range with custom API.
Please let us know if this solution works for you.

Best Regards,
Maksym

Public
Menachem 3 days ago

Hello
yes. it did work for me and i can filter the data.
Although, i had to come up with a way to let the user know they can't look for dates before / after a specific date.

Thanks.

Public
Maksym Diachenko Maksym Diachenko Flexmonster 2 days ago

Hello, Menachem!

Thank you for your feedback.
We are glad to hear that the suggested approach worked for you. 
Feel free to contact us if any additional questions arise.

Best Regards,
Maksym

Please login or Register to Submit Answer