react-native-datetimepicker / datetimepicker

React Native date & time picker component for iOS, Android and Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`minimumDate` and `maximumDate` not working for `mode={'time'}` on Android?

the-devbear opened this issue · comments

Question

Hello, my question is if this feature is supported for Android, because on IOS it works perfectly fine.
But on Android I can still set a time in future/past even with the minimumDate and maximumDate props set.

This is what I use:

<RNDateTimePicker
          mode='time'
          minimumDate={new Date('2024-05-12 16:00')}
          maximumDate={new Date()}
          display={Platform.OS === 'android' ? 'default' : 'default'}
          value={time}
/>

Am I doing something wrong?
Any help is appreciated. Thanks

In the docs (maximumDate & minimumDate props), it's clearly mentioned that Android doesn't support this feature for TimePicker.

Note that on Android, this only works for date mode because TimePicker does not support this.

Ohhh, yea it totally does. You could have dropped a RTFM 🤣.
Thank you!