[IOS] When setting minimumDate to new Date() the picker doesn't show correct initial value and set always new Date()
See original GitHub issueBug
Environment info
react-native info
output:
"react-native": "0.61.5"
"@react-native-community/datetimepicker": "^2.2.3",
Describe what you expected to happen:
- I expect to init the picker with
this.state.date
- Instead it initialize with
new Date()
Reproducible sample code
<DateTimePicker
style={{width:'100%', backgroundColor: 'white', position: 'absolute', bottom: 0, zIndex: 10}}
value={this.state.date}
mode={this.state.mode}
is24Hour={true}
onChange={this.onChangePicker}
minimumDate={new Date()}
/>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
[IOS] When setting minimumDate to new Date() the picker ...
[IOS] When setting minimumDate to new Date() the picker doesn't show correct initial value and set always new Date() #139.
Read more >Minimum and maximum date in UIDatePicker - Stack Overflow
datePicker.minimumDate = MinDate; // self.datePicker.maximumDate = MaxDate;. but I cant get this integer to my date format.
Read more ><input type="date"> - HTML: HyperText Markup Language
You can set a default value for the input with a date inside the value ... the available dates (see Setting maximum and...
Read more >Demystifying DateTime Manipulation in JavaScript - Toptal
If you instead want to get the current time stamp, you can create a new Date object and use the getTime() method. const...
Read more >Datepicker documentation for React | Mobiscroll
Name Type Default value
anchor HTMLElement undefined
animation String, Boolean undefined
buttons Array
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Having the same issue:
In this case, the date picker opens up to 31 Jan 2020, pressing the confirm button sets the date to todays date rather than 31 Jan 2020. Works fine on Android
+1 i had initialised my datePicker with new Date() but provided the maximum date of 14 years back. the picker shows the correct date but when i select the date it returns new Date(). i guess onChange is not getting called with the maximum date