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

Add optional props for setting minDays, maxDays, dateRange #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mattvoss
Copy link

Add optional props

  • minDays: minimum number of days that must be selected. If the
    date range selected is less than minDays specified then the
    amount of days selected will be automatically increased.
  • maxDays: maximum number of days that can be selected. If the
    date range exceeds the number of maxDays specified then the
    amount of days selected will be automatically reduced.
  • dateRange: different from initialDateRange as this is a controlled value

Add optional props
- minDays: minimum number of days that must be selected. If the
  date range selected is less than minDays specified then the
  amount of days selected will be automatically increased.
- maxDays: maximum number of days that can be selected. If the
  date range exceeds the number of maxDays specified then the
  amount of days selected will be automatically reduced.
- dateRange: different from initialDateRange as this is a contolled
  value
@miyushan
Copy link
Owner

Awesome! 🎉
Thanks for adding this feature @mattvoss. It's a nice one. I'll review the PR and get back to you soon.

Just a small suggestion: since dateRange is also controllable, you might consider utilizing this prop in your feature. Please correct me if I’m wrong. Thanks!

@mattvoss
Copy link
Author

@miyushan It is used in the PR.

dateRange had been local state in the useDateRangePicker hook which I renamed internalDateRange in support of minDays and maxDays. You can see on line 65 now the dateRange prop is destructured to {startDate, endDate} if dateRange exists otherwise internalDateRange is destructured

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

Successfully merging this pull request may close these issues.

2 participants