React-datepicker: Examples not working

Created on 3 May 2019  路  2Comments  路  Source: Hacker0x01/react-datepicker

Expected behavior

In the example for Exclude Dates, the excludeDates attribute is written as
excludeDates={[new Date(), subDays(new Date(), 1)] When I include this line in my code it should exclude the current date and the previous date.

Actual behavior

When I attempt to use this in my component I receive an error that subDays is not defined

wontfix

Most helpful comment

subDays is defined in date-fns library and you can find it in ./es/index.js. You have to import it like this
import subDays from "date-fns/subDays"; into your code but you have to have "npm install date-fns"

All 2 comments

subDays is defined in date-fns library and you can find it in ./es/index.js. You have to import it like this
import subDays from "date-fns/subDays"; into your code but you have to have "npm install date-fns"

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings