-
-
Notifications
You must be signed in to change notification settings - Fork 424
[Android] Fix issue with minimumDate/maximumDate when using timeZoneOffsetInMinutes #519
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
[Android] Fix issue with minimumDate/maximumDate when using timeZoneOffsetInMinutes #519
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello and thank you for the PR!
I have added some small comments. Also, I'd really appreciate if you could add some e2e tests for this so that we know the android and ios behavior is the same, since the tz offset on android is not working 100%.
Selecting dates on android is kinda pain, the best way I know is in this PR: //github.com/react-native-datetimepicker/datetimepicker/pull/new/fix/use-resource-ids
Also, can you please rebase on master?
thank you for your time! :)
android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java
Outdated
Show resolved
Hide resolved
android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java
Outdated
Show resolved
Hide resolved
Thanks for reviewing and pointing me in the right direction on the android date picker selection for the e2e test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello and thanks so much, I'd like to ask for a few more small changes and then we're good to merge! :)
thanks
android/src/main/java/com/reactcommunity/rndatetimepicker/RNDatePickerDialogFragment.java
Outdated
Show resolved
Hide resolved
…tePickerDialogFragment.java Co-authored-by: Vojtech Novak <[email protected]>
Co-authored-by: Vojtech Novak <[email protected]>
Thank you for reviewing! Let me know if you want anything else :) |
🎉 This issue has been resolved in version 5.0.2 🎉 If this package helps you, consider sponsoring us! 🚀 |
Fixes #518
Summary
On Android
setMinDate
andsetMaxDate
assumes the datetime passed will be in the device's local timezone, we now account for this by subtracting the minimumDate/maximumDate datetime offsets and also the provided timeZoneOffsetInMinutes.Test Plan
I've added a
toggleMinMaxDate
button in the demo project that shows this feature using two UTC min/max dates. Here is the before/after in -4 GMT.Before:


After:
What's required for testing (prerequisites)?
Test using the
toggleMinMaxDate
button in the demo project.FYI - I was unable to find a good way to pick a date using detox for e2e tests on Android.
What are the steps to reproduce (after prerequisites)?
Using any negative timezone on the device should show this issue in the demo project.
Compatibility
Checklist
README.md
example/App.js
)