The date range is from 10 years ago to 10 years later.
primedev22 opened this issue · comments
I want to use this package to set Date of Birth. But it can only represent date from 10 years ago.
@risingtalent22
I believe you can pass in maximumDate
and minimumDate
changing it.
export default class DatePicker extends PureComponent {
static propTypes = {
labelUnit: PropTypes.shape({
year: PropTypes.string,
month: PropTypes.string,
date: PropTypes.string,
}),
order: PropTypes.string,
date: PropTypes.instanceOf(Date).isRequired,
maximumDate: PropTypes.instanceOf(Date),
minimumDate: PropTypes.instanceOf(Date),
mode: PropTypes.oneOf(['date', 'time', 'datetime']),
onDateChange: PropTypes.func.isRequired,
style: ViewPropTypes.style,
textColor: ColorPropType,
textSize: PropTypes.number,
itemSpace: PropTypes.number,
};
static defaultProps = {
labelUnit: { year: '', month: '', date: '' },
order: 'D-M-Y',
mode: 'date',
maximumDate: moment().add(10, 'years').toDate(),
minimumDate: moment().add(-10, 'years').toDate(),
date: new Date(),
style: null,
textColor: '#333',
textSize: 26,
itemSpace: 20,
};