TypeError: Cannot read property '_date' of undefined when using Chartjs 3.x.x
esttenorio opened this issue · 4 comments
esttenorio commented
The import on the index.js seems to fail when using in a typescript project.
After locally changing from import {Chart} from 'chart.js';
to import * as Chart from 'chart.js';
the extension works again.
I checked the charts repo and the adapters are separate. There's no default export of ChartJs so the fix is:
- update ChartJs ts exports so Chart is the default export
- on this adapter change the import to
import * as Chart from 'chart.js';
or - on this adapter change the import to `import {_adapter} from 'chart.js';
etimberg commented
Was this fixed in v1.0.0-beta.1? https://github.com/chartjs/chartjs-adapter-moment/releases/tag/v1.0.0-beta.1
esttenorio commented
no, that's precisely the package I'm using:
"chartjs-adapter-moment": "^1.0.0-beta.1",
etimberg commented
Ah, ok. I thought I had fixed it. Will take another look. Does import {_adapters} from 'chart.js';
work for you?
esttenorio commented
Thanks for publishing a new version with a fix so quickly