-
Notifications
You must be signed in to change notification settings - Fork 195
Add date range support #49
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
Conversation
|
Hey looks good, I have some feedback but I could be wrong: |
|
I turned the dates into strings so that the same date would maintain the same reference to I figured this was the desired outcome, since That said, if someone uses |
|
Yeah I know, but that's exactly what the useLatest hooks solve since it will not re-render since the dependency is a ref! |
|
Yeah, makes sense. I wanted to make sure we avoid stale values, but I think that should work fine. |
|
Yeah should work good https://twitter.com/dan_abramov/status/1063801478584897536. I use useLatest for more things so if it does not work the library has a problem anyway because I use the same trick in other places to prevent re-rendering |
|
Fixed. I left it as a string for |
|
Also included exports to close #47 |
|
@RichardLindhout just confirming that sounds good to you. We should be triggering a re-render if the datetime string changes. Otherwise, changing the valid range would result in stale UI. In the case of a press, using a ref is fine. |
|
I'm using a fork now in my app, it's all working well. |
Added support for an optional
validRangeprop. Closes #48.Usage:
Both
startDateandendDateare optional.List
validRangeto example app