This pull request solves https://github.com/react-native-datetimepicker/datetimepicker/issues/935 . According to old code when you provide only maximum date, it gets minimum date timestamp as 0 (which is Thursday, January 1, 1970 12:00:00 AM) . As a result when you select the date before the minimum date, it selects minimum date, I am not sure whether it is a bug because I think you shouldn't select a date before minimum date if you give a value to maximum date . However, Maybe used minimumDate value can be changed here because there is a constant which is DEFAULT_MIN_DATE timestamp equals to -2208988800001l in RNConstants.java. You can see the code below in RNConstants.java
/**
* Minimum date supported by {@link TimePickerDialog}, 01 Jan 1900
*/
public static final long DEFAULT_MIN_DATE = -2208988800001l;
And this constants matches 01 Jan 1990 date. My pull request only changes minDate as 01 Jan 1900, if this minDate is not provided by the user.
Test Plan
What's required for testing (prerequisites)?
You can use your physical devices or emulators for testing.
What are the steps to reproduce (after prerequisites)?
You can use the js code below for seeing the bug. You can replace example/App.js code with the code below:
…n only a maximum date is provided on Android
Summary
The error was described in https://github.com/react-native-datetimepicker/datetimepicker/issues/935
This pull request solves https://github.com/react-native-datetimepicker/datetimepicker/issues/935 . According to old code when you provide only maximum date, it gets minimum date timestamp as 0 (which is Thursday, January 1, 1970 12:00:00 AM) . As a result when you select the date before the minimum date, it selects minimum date, I am not sure whether it is a bug because I think you shouldn't select a date before minimum date if you give a value to maximum date . However, Maybe used minimumDate value can be changed here because there is a constant which is
DEFAULT_MIN_DATE
timestamp equals to-2208988800001l
in RNConstants.java. You can see the code below in RNConstants.javaAnd this constants matches 01 Jan 1990 date. My pull request only changes minDate as 01 Jan 1900, if this minDate is not provided by the user.
Test Plan
What's required for testing (prerequisites)?
You can use your physical devices or emulators for testing.
What are the steps to reproduce (after prerequisites)?
You can use the js code below for seeing the bug. You can replace example/App.js code with the code below:
Some Videos For Showing Changes
Before Changes: https://github.com/user-attachments/assets/42a6f688-37c1-4b1d-9f17-4e84b285f35b
After Changes: https://github.com/user-attachments/assets/673fb04f-9e8f-4f52-942e-c7af065d1d59
Compatibility
Checklist
README.md
example/App.js
)