29π
It turns out, the solution entails version controls (here is what I used):
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script>
16π
I had this same issue and attempted Kevinβs solution, but it did not work. I found that it was necessary to place the moment script before the chartjs script and regardless of the versions I used, that solved the problem for me.
8π
You have to use the bundle version of Chartjs that already include Moment.js
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.bundle.js"></script>
1π
If you are using npm
npm install moment chartjs-adapter-moment --save-dev
in your files
import { Chart } from 'chart.js'
import 'chartjs-adapter-moment';
- [Chartjs]-Draw a Chart.js with ajax data and responsive. A few problems and questions
- [Chartjs]-Different color for each bar in a bar chart; ChartJS
0π
I had the same error while trying to use chartkick gem for rails.
And the solution was to install moment.js
(npm install moment --save
) and put
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
in the application.html.erb
Source:stackexchange.com