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

Clicking days on a calendar with multiple months makes it jump forward #38

Closed
gpbl opened this issue Jul 29, 2015 · 7 comments
Closed

Comments

@gpbl
Copy link
Owner

gpbl commented Jul 29, 2015

For example, in the Range of days example when clicking on a day on the right month, it makes it jump to the next month.

@gpbl gpbl added the bug label Jul 29, 2015
@gpbl
Copy link
Owner Author

gpbl commented Jul 29, 2015

/cc @anton-kabysh

@gpbl gpbl changed the title Clicking days on a calendar with multiple months makes it jump forward or backward Clicking days on a calendar with multiple months makes it jump forward Jul 29, 2015
@gpbl
Copy link
Owner Author

gpbl commented Jul 29, 2015

The reason for this behavior is the code added to navigate the calendar when clicking on outside days. The month should change instead only if the day has the outside modifier, and if it does not appear in the calendar.

@HNBowen
Copy link

HNBowen commented Oct 1, 2018

@gpbl I'm still seeing this issue in the example and in my own implementation. I'm using v 7.2.4 of the library.

@gpbl
Copy link
Owner Author

gpbl commented Oct 1, 2018

@HNBowen which example? Here it works: https://codesandbox.io/s/x9rpwqrlz4?module=/example

@HNBowen
Copy link

HNBowen commented Oct 1, 2018

@gpbl Sorry, I actually meant the Day Picker Input example. My bad! You can see the behavior I'm talking about in the 'Works with input fields' example on the react-day-picker.js.org home page. Clicking on the second month in the 'Range of days' calendar advances the calendar to the next month.

I think it may be this line?

this.setState({ value, typedValue: undefined, month: day }, () => {

Clicking on a valid day resets the month of the overlay to the month of the day clicked, which I believe advances the calendar and causes the jump. Is this by design? Any advice for stopping the calendar from jumping ahead?

@gpbl
Copy link
Owner Author

gpbl commented Oct 1, 2018

@HNBowen oh I see. It looks like the fromMonth prop in dayPickerProps is ignored. Would you open another issue? And maybe investigate this? 🙏🏽

dayPickerProps={{
selectedDays: [from, { from, to }],
disabledDays: { before: from },
modifiers,
month: from,
fromMonth: from,
numberOfMonths: 2,

@HNBowen
Copy link

HNBowen commented Oct 1, 2018

@gpbl You got it!

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

No branches or pull requests

2 participants