You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 19, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on May 19, 2025. It is now read-only.
This happens because create-react-app doesn't support *.cjs files. So require('date-fns') returns a string (more specifically, a URL to a *.cjs file), instead of a JS module object. Hence the error.
ERROR
(0 , _dateFns.addYears) is not a function
TypeError: (0 , _dateFns.addYears) is not a function
at ./node_modules/react-date-range/dist/components/Calendar/index.js (http://localhost:3000/static/js/vendors-node_modules_react-date-range_dist_index_js-node_modules_date-fns_addDays_js.chunk.js:660:34)
at options.factory (http://localhost:3000/static/js/bundle.js:72242:31)
at webpack_require (http://localhost:3000/static/js/bundle.js:71630:32)
at fn (http://localhost:3000/static/js/bundle.js:71901:21)
at ./node_modules/react-date-range/dist/components/DateRange/index.js (http://localhost:3000/static/js/vendors-node_modules_react-date-range_dist_index_js-node_modules_date-fns_addDays_js.chunk.js:1052:40)
at options.factory (http://localhost:3000/static/js/bundle.js:72242:31)
at webpack_require (http://localhost:3000/static/js/bundle.js:71630:32)
at fn (http://localhost:3000/static/js/bundle.js:71901:21)
at ./node_modules/react-date-range/dist/index.js (http://localhost:3000/static/js/vendors-node_modules_react-date-range_dist_index_js-node_modules_date-fns_addDays_js.chunk.js:2316:41)
at options.factory (http://localhost:3000/static/js/bundle.js:72242:31)