Disable specific dates and support ranges #9059
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Attempting to solve this use-case: #8402
When you want to allow users to choose a Start and End date, but not allow them to create a range that intersects disabled dates.
Disabled dates
Consider a table with holidays that you want to disable from the date picker calendar:
You can use the Disabled dates field to disable these dates. In this case the following handlebars expression is being used:
{{ pluck DisabledDates Data Provider.Rows 'Holiday' }}
Date range
There was some code already in here to handle a little bit of the flatpickr range mode, however I wasn't able to find anywhere that actually used it, but if there is some other use of the functionality I need to test then let me know!
Added a check box for Range mode. When ticked, you can select a date field as the To (end) date.
This is probably a bit unorthodox as it involves registering two form fields in one component, but here's an example form:
Unticking the range mode will revert to using the Start date only.
Addresses:
App Export
Date Picker Range-export.tar.gz