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

1282 reactdaypicker updates date ranges when only start date is selected #1299

Conversation

nichhk
Copy link
Member

@nichhk nichhk commented Jul 28, 2022

Fixes #1282

  • Significantly simplify the way that we pick date ranges in ReactDayPicker. By default, a date range (past week) is already selected. When a date range is already selected and the user clicks on a new date, we don't perform any logic to attempt to preserve the start or end date; we just create an entirely new date range, starting from the date that the user clicked on.
  • Update index.js to only retrieve new data when the end date has changed (not start date).

This also fixes a couple bugs around pulling data for new date ranges, in index.js.

  • When getting the non-overlapping ranges for two ranges A and B, we need to check whether A and B overlap. This will make a difference in the non-overlapping range.

  • When we are resolving the date ranges, if we find that the next date range doesn't overlap with our current one, we need to add the current one to our list of date ranges and then set the new current date range to be the next one.

    • Up to date with dev branch
    • Branch name follows guidelines
    • All PR Status checks are successful
    • Peer reviewed and approved

Any questions? See the getting started guide

@nichhk nichhk requested review from funbunch and ardada2468 July 28, 2022 16:32
@nichhk nichhk linked an issue Jul 28, 2022 that may be closed by this pull request
1 task
Copy link
Contributor

@ardada2468 ardada2468 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but In contact form do we need to console.log state?

Copy link
Member

@funbunch funbunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, looks good!

@ardada2468 ardada2468 merged commit 545fcfb into dev Jul 28, 2022
@ardada2468 ardada2468 deleted the 1282-reactdaypicker-updates-date-ranges-when-only-start-date-is-selected branch July 28, 2022 17:19
@nichhk nichhk mentioned this pull request Jul 28, 2022
1 task
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.

ReactDayPicker updates date ranges when only start date is selected
3 participants