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

Giving internal state 'dateString' first priority for input value. #1287

Merged
merged 1 commit into from
Aug 10, 2018

Conversation

nbakken8
Copy link

Resolve #1013

It's an issue with react when replacing the entire string value vs internal managed state.

This change will use dateString when the user is typing within the input field and switch over to displayValue when a date is selected via the calendar.

@coveralls
Copy link

coveralls commented Jul 25, 2018

Coverage Status

Coverage remained the same at 84.82% when pulling 8c5c000 on nbakken8:input-cursor into ffe96d9 on airbnb:master.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

This seems like a simple solution, which is great! Can we add a regression test for this?

@ljharb ljharb added the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Jul 25, 2018
@nbakken8
Copy link
Author

Test has been added that ensures the prop will take precedence over the state when passed in. Within the same file, tests on lines 19, 25, and 102 do a great job of covering scenarios as well.

Copy link
Collaborator

@majapw majapw left a comment

Choose a reason for hiding this comment

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

This seems great and simple to me! :)

@majapw majapw merged commit 4905b3d into react-dates:master Aug 10, 2018
@nbakken8 nbakken8 deleted the input-cursor branch August 10, 2018 16:36
@imrank1
Copy link

imrank1 commented Aug 10, 2018

This fix is awseome. Any idea when is a new version of react-dates going to be pushed to npm with this fix?

@majapw
Copy link
Collaborator

majapw commented Aug 14, 2018

@imrank1 will get it out as soon as #1305 is merged in! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch: fixes/refactors/etc Anything that's not major or minor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants