chartjs-adapter-date-fns icon indicating copy to clipboard operation
chartjs-adapter-date-fns copied to clipboard

fails to resolve toDate if [email protected] is used elsewhere in project

Open gsar opened this issue 4 years ago • 3 comments

It appears [email protected] is no longer listed in peerDependencies, so when this is used in a project that has other things that depend on [email protected], it fails to load with the error:

image

since [email protected] doesn't have toDate.

gsar avatar Apr 07 '21 00:04 gsar

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

kurkle avatar Apr 07 '21 03:04 kurkle

@kurkle maybe we need dependencies rather than peerDependencies. this package certainly requires [email protected] 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.

gsar avatar Apr 08 '21 15:04 gsar

https://github.com/chartjs/chartjs-adapter-date-fns/pull/39 would solve this

PowerKiKi avatar Jun 18 '21 12:06 PowerKiKi