Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to resolve toDate if date-fns@1.x is used elsewhere in project #32

Open
gsar opened this issue Apr 7, 2021 · 3 comments
Open

Comments

@gsar
Copy link

gsar commented Apr 7, 2021

It appears date-fns@2.0 is no longer listed in peerDependencies, so when this is used in a project that has other things that depend on date-fns@1.x, it fails to load with the error:

image

since date-fns@1.x doesn't have toDate.

@kurkle
Copy link
Member

kurkle commented Apr 7, 2021

Listing as peer dependency does not help with missing functions. I think you have to pin a version prior to 1.0.0 to use with date-fns v1

@gsar
Copy link
Author

gsar commented Apr 8, 2021

@kurkle maybe we need dependencies rather than peerDependencies. this package certainly requires date-fns@2.x so shouldn't there be a dependency declared in package.json? since there is no declared dependency it seems to be resolving the older version (even though both versions are available) and failing.

adding the dependency will make yarn/npm populate a siloed node_modules tree within the installed code and everything should work.

@PowerKiKi
Copy link

#39 would solve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants