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

startDate should be always set before endDate #194

Closed
xersiee opened this issue Dec 3, 2018 · 1 comment
Closed

startDate should be always set before endDate #194

xersiee opened this issue Dec 3, 2018 · 1 comment

Comments

@xersiee
Copy link

xersiee commented Dec 3, 2018

When updating picker's value programatically, it sets endDate first and startDate after this (this is determined by the order of options in getOptions). However, when setting endDate, bootstrap-daterangepicker ensures that endDate > startDate and sets startDate value to endDate if not. This can cause incorrect behavior in the following scenario:

  1. Create date range picker in single mode
  2. Combine it with <input> that can be edited and used to update picker's state from the outside
  3. Initialize picker with some date, lets say 2018-01-07
  4. Change manually date in the input to 2018-01-01 (must be date before original date)

5. Open picker - picker shows range 2018-01-01 - 2018-01-07

  1. Close and open again - show correctly single date: 2018-01-01

Quick workaround in my code was to call setState({ startDate: ...}) first and setState({ endDate: ...}) in the callback, but I believe it should be fixed in react-bootstrap-daterangepicker's code, so setting two values at once works correctly.

@skratchdot
Copy link
Owner

closing this due to inactivity. please re-open if this is still an issue in v6.0.0 or greater

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