[Chartjs]-Chart.js moment locale

2👍

Moment’s locale must be set before the chart load else the chart must be updated with update().
https://github.com/chartjs/Chart.js/issues/3108

0👍

Chart.js won’t do date formatting for you – the amount of possibilities and locales are so vast it fits well beyond the scope of the project – in face there are libraries just for different formatting of javascript dates. One good example could be something like http://momentjs.com/.

For plotting data you should use seconds/minutes/hours as most appropriate for your data. You can customise how you format this in your interpolated JS string for labels – scaleLabel. For chart labels, you should just use formatted strings as you see most fit.

source: https://github.com/chartjs/Chart.js/issues/79

0👍

You must include your moment locale file on your page:

Ex.: You can find your locale using CDN
https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/locale/pl.js

Ex.: Bower

<script src="/bower_components/moment/moment.js"></script>
<script src="/bower_components/moment/locale/de.js"></script>

Leave a comment