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

Bug when DateTimePicker value is null, user cannot navigate between months #32

Closed
felixakiragreen opened this issue Nov 13, 2014 · 2 comments

Comments

@felixakiragreen
Copy link

When a DateTimePicker value starts with a null date, the calendar drop down shows the current month, but the user cannot navigate months until a date is selected. Then the the user can click previous and next months.

@jquense
Copy link
Owner

jquense commented Nov 13, 2014

Hey @DUBERT I am not able to recreate on the docs site, or on my local build (both 2.x and 1.5). Perhaps there is a min/max that is getting set?

@felixakiragreen
Copy link
Author

I finally figured this out, though I don't have a good solution.

When the value is null, the DateTimePicker passes a new Date object to the Calendar widget. For some reason with the way my app is set up, whenever I clicked to navigate right or left, it updated the value so a new Date object was created, which caused this line to trigger in Calendar.js:

//if the value changes reset views to the new one
    if ( !dates.eq(val, this.props.value, VIEW_UNIT[view]))
      this.setState({
        currentDate: val
      })

This would reset the state to the new value, so it would never navigate right or left. As soon as it had an actual value, then it wouldn't create a new Date, so the value wouldn't be different, so it wouldn't be triggered.

UPDATE: Just figured it out. I added an onClick function to my component, and stopped event propagation.

This issue was closed.
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