AppAndFlow / react-native-quickpicker

A simple Picker for react-native that works out of the box on both iOS and Android
66 stars 9 forks source link

Using Minimum and Maximum date #1

Closed jmelendev closed 6 years ago

jmelendev commented 6 years ago

Hey there,

This may be a question more than an issue but how could i prevent the date picker from picking a date in the past and prevent the date from being more than 24 hours from now?

Valiums commented 6 years ago

Hi @jmelendev!

I guess you could do:


const minimumDate = new Date();
and then
const maximumDate = new Date();
maximumDate.setDate(maximumDate.getDate() + 1);

then on the picker config you set 
minimumDate={minimumDate}
maximumDate={maximumDate}

I think that should do it :)