pinguinjkeke / react-native-wheel-datepicker

Android & iOS iOS-style Picker & DatePicker Components for ReactNative

Home Page:https://www.npmjs.com/package/react-native-wheel-datepicker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The date range is from 10 years ago to 10 years later.

primedev22 opened this issue · comments

commented

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,
  };