Disable Dates in DatePicker Form Widget in backend

Hey everyone, is there a way to disable dates in the datepicker?

My use case is that a person can request to change their dates for their booking via email, but we have to update them in the backend. There are already dates that are booked, and I would love to disable them in the backend so we know what dates are available.

Hey @artistro08

We can include disableDays in the form field definition

added_at:
    label: Date Added
    type: datepicker
    disableDays:
        - 0 # Sunday
        - 6 # Saturday
        - "2023-04-12"  #today

But I assume you want this to be dynamic, how would you source the disabled days?

1 Like

That would be awesome. I would source them from a tailor model, or a function that gets the disabled days and return them there.

Ok. A model function or static function could be used, similar to the way options work. If you can handle it from there, then it should be a winner.

Sounds good! For context, this isn’t built yet, correct?

Yes, this is still in proposal/design stage. We’ve added it to our internal tracker.

1 Like

This is complete and has been included in versions after v3.4.12

2 Likes