Open winsmith opened 2 years ago
@winsmith may I ask you if you can reproduce the issue in codepen?
Only thing I can think off by that error is that you dont import the adapter, thats the only way you get that error afaik, when I try it, it seems to work fine: https://codesandbox.io/s/react-typescript-forked-5s45fs?file=/src/App.tsx
Is there a reason ChartJS doesn't support native Javascript dates, rather than forcing an adapter ?
Date
has basically no features. Hopefully we can remove date adapters after https://github.com/tc39/proposal-temporal
And I assume you need some of these features with ChartJS ? May I ask why, if you also support raw timestamps (that have no features since they are just numbers)
You can take a look here for everything we need to do: https://github.com/chartjs/chartjs-adapter-luxon/blob/master/src/index.js
After updating from ChartJS 3.7.1 to ChartJS 3.8, any charts that would use the Luxon adapter stopped working. It seems that ChartJS changed the way their modules are exported slightly and the patches that chartjs-adapter-luxon is making don't register any more, at least in my project.
Any charts that use datetimes don't display any more and the console shows this error message:
My workaround for this right now has been to create a new helper file,
chart-js.js
, and doing the patching manually by copy/pasting the code from the adapter source. Then I can import the new Chart object from that helper file.I realise this is probably very hacky, but I don't really have the experience to find out what the actual problem is.
Here's my new import:
And here's my
ui/utils/chart-js.js
: