-
-
Notifications
You must be signed in to change notification settings - Fork 325
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 DateTime picker bugs with minDate and maxDate #670
Comments
Hi, thanks for reporting this. What timezone is the simulator/phone using? Note that |
Hi! The simulator phone was using UTC+3 timezone. |
Hi, I am facing the same issue on android with minDate and maxDate PS: reverting to version of 4.1.3 fixed the problem. |
Same issue on 4.3.3 Is there a plan to fix this on the near future? |
I found the date picker will display the number of days equal to max-min/24, rounded DOWN. So if minDate is 1 second from now, and max is 3 days from now, it will only show 2 days. If max is 3 days and 1 second from now, behaviour is as expected. (All Android, iOS is fine it seems). |
Thanks for helping out understanding this bug. I managed to reproduce it and fix it by #740. It is released in version 4.3.5. Please let me know if you still experience anything unexpected after upgrading to 4.3.5. |
Description of the bug
Found a series of bugs when trying to use date picker on Android with DateTime mode regarding the minDate and maxDate props.
Without specifying minDate value the maximum time user can go back is 6 months.
Current date was 30. June.
If I specify minDate value for example selectedDate - 1 year and dont set a maxDate then when opening the date picker the default value will be the minDate value and maximum time I could select was minDate + 6 months. So comparing to current date I could select a date between -1 year and -6 months.
minDate set as (selectedDate - 1 year), maxDate is undefined, tried to scroll to the furthest date in the future
If I specify minDate value for example selectedDate - 1 year and maxDate as current date it works as expected initially.
But once I select a different date in the past and reopen the picker (in this case current_date -23h57m) user can no longer select "Today" as a date.
The issue is that I cant leave minDate undefined since I want user to be able to select a date from a calendar and then select a time period in regards to that selected date. If minDate is undefined they cant go back further than 6 months. But if I leave minDate undefined I run into the wrong default value and stuck with the past dates issue. And if I do set maxDate so they cant select dates in the future then in some situations after editing the current value they cant select current date ("Today") anymore.
Expected behavior
Similar behavior to iOS, you can freely set minDate and maxDate value without it altering the usability of the datepicker.
Example code
<DatePicker
date={new Date(props.date)}
onDateChange={props.onChange}
style={styles.datePicker}
mode={'datetime'}
is24hourSource="locale"
fadeToColor="none"
minimumDate={props.minDate || null}
maximumDate={props.maxDate || null}
/>
Smartphone (please complete the following information):
OS: Android
React Native version 0.67.5
react-native-date-picker version 4.2.12
The text was updated successfully, but these errors were encountered: