buildo / react-components

Collection of general React components used in buildo projects.
http://react-components.buildo.io/
MIT License
157 stars 21 forks source link

DatePicker doesn't allow to select past days #1266

Closed Cardu closed 6 years ago

Cardu commented 6 years ago

Project card

description

even if I set the property minDate to a past value, the picker does not let you choose a past day

how to reproduce

just try it in the live example, set minDate='Thu Aug 30 2017 12:00:00 GMT+0200'

specs

because we are based on react-date SingleDatePicker, I looked into our and their code and I think we just need to override their isOutsideRange method to return false only after the given mindate

this is their implementation:

https://github.com/airbnb/react-dates/blob/master/src/components/SingleDatePicker.jsx

isOutsideRange: day => !isInclusivelyAfterDay(day, moment()),