chartjs/chartjs-adapter-moment

Enhancement: what do you think to add I18N support?

stockiNail opened this issue · 4 comments

Currently the adapater is not managing the I18N.

Nevertheless Moment.js is supporting I18N and due to CHART.JS 3 introuced the locale options, maybe it could make sense to add this kind of support also for Moment adapter.

In my opinion to use I18N in moment, the user should:

  1. should have a look how to prepare the I18N into Moment.js (see doc https://momentjs.com/docs/#/i18n/) in order to be aware how to leverage on this feature, depending on the runtime; environment;
  2. pass an options (like the other adapters) where is setting the locale as following:
// time scale config
scales: {
    x: {
        type: 'time',
        adapters: {
            date: {
                locale: 'en-US'
            },
        },
        time: {
            unit: 'day'
        }
    },
}

What do you think? If you think it could be helpful, I can try to submit a PR.

I don't know that I'm necessarily against the feature, but if you want i18n you're really much better off using Luxon. It results in much smaller bundles because it uses the browser's built-in i18n support

@benmccann ok I agree because could make sense to use Luxon if you need I18N.
Thank you very much