question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

maxDate is not working on ios

See original GitHub issue

Issue

When i’m using react-native-datepicker, maxDate properties working correctly in android but is not working on ios.

Code

                              <DatePicker
                                    style={{
                                    width: api.getRealDeviceWidth() * 0.9
                                }}
                                    date={this.state.dob}
                                    mode="date"
                                    placeholder="select date"
                                    format="YYYY-MM-DD"
                                    minDate={'1960-01-01'}
                                    maxDate={'1995-01-01'}
                                    confirmBtnText="Confirm"
                                    cancelBtnText="Cancel"
                                    showIcon={false}
                                    customStyles={{
                                    dateInput: {
                                        borderColor: '#cdcdcd',
                                        borderRadius: 2,
                                        height: 36
                                    },
                                    dateText: {
                                        textAlign: 'left',
                                        width: api.getRealDeviceWidth() * 0.9,
                                        padding: 12
                                    }
                                }}
                                    onDateChange={(date) => {
                                    this.setState({dob: date})
                                }}/>

Environment

  1. react-native -v: 0.40.0
  2. target platform: iOS
  3. operating system: Linux

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

3reactions
kamranyounis12commented, May 29, 2018

keeping format of minDate and maxDate same as format of DatePicker, solved the problem for me.

2reactions
rikurcommented, Aug 14, 2019

@kamranyounis12 is right, the dates are compared via simple < and > comparison so you need to supply the dates in identical/comparable formats. I’m passing a native JS new Date() to each.

Read more comments on GitHub >

github_iconTop Results From Across the Web

minDate & maxDate not working on iOS? · Issue #16 - GitHub
I'm trying to use minDate and maxDate but doesn't seem to work on iOS. This is how my Picker looks: <DatePicker onDateChange={this.
Read more >
Mobile IOS input type date min and max not working on ...
It appears that this has already been asked here: Html 5 [input type=Date] control, MAX date is not working in iPhone/Ipad.
Read more >
Html 5 [input type=Date] control, MAX date is not working in ...
HTML : Html 5 [input type=Date] control, MAX date is not working in iPhone / Ipad [ Gift : Animated Search Engine :...
Read more >
react-native-community/datetimepicker - npm
React Native date & time picker component for iOS, Android and Windows ... Other configurations are very likely to work as well but...
Read more >
[Solved]-Maxdate not updating after app went in background for a ...
Related Query · Updating locations while app in background working on simulator but not on device (iOS 9) · guaranteed delivery for uploads...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found