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

Disable specific dates and support ranges #9059

Closed
wants to merge 3 commits into from

Conversation

melohagan
Copy link
Collaborator

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:
Screenshot 2022-12-15 at 14 10 41

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' }}

Screenshot 2022-12-15 at 14 12 12

Screenshot 2022-12-15 at 14 12 31

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.
Screenshot 2022-12-15 at 14 15 17

Screenshot 2022-12-15 at 14 16 06

This is probably a bit unorthodox as it involves registering two form fields in one component, but here's an example form:
Screenshot 2022-12-15 at 14 20 47

Screenshot 2022-12-15 at 14 19 35

Screenshot 2022-12-15 at 14 21 42

Unticking the range mode will revert to using the Start date only.

Addresses:

App Export

Date Picker Range-export.tar.gz

@mike12345567
Copy link
Collaborator

Hey @melohagan had a look through this - I think its an important change but I'm not sure this is the correct way to go about it. We've a relatively large dependence on flatpickr right now - which we don't like - this will increase our dependency on the package and make it harder to replace.

I also think from our technical point of view breaking this out into a separate component, so we have a Date Picker and a Range Picker would be preferable - I had a chat with @aptkingston about this - there already is a component we use in the builder, it would just need to be exposed to the client library.

Going to close this for now as I think we'll need to think further about this - the date picker is already quite problematic and I wouldn't want to worsen the issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2023
@melohagan melohagan deleted the feature/disable-specific-dates branch January 20, 2023 10:28
@melohagan
Copy link
Collaborator Author

Hey @melohagan had a look through this - I think its an important change but I'm not sure this is the correct way to go about it. We've a relatively large dependence on flatpickr right now - which we don't like - this will increase our dependency on the package and make it harder to replace.

I also think from our technical point of view breaking this out into a separate component, so we have a Date Picker and a Range Picker would be preferable - I had a chat with @aptkingston about this - there already is a component we use in the builder, it would just need to be exposed to the client library.

Going to close this for now as I think we'll need to think further about this - the date picker is already quite problematic and I wouldn't want to worsen the issue.

That's fair - thanks for having a look!

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

Successfully merging this pull request may close these issues.

2 participants