-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
displayFormats unexpected result #46
Comments
I thinks you need to use the tokens.
|
@ocarreterom I think the The Try and let us know if the following works: displayFormats: {
day: "EEEE"
} |
@kurkle yes, that works but the result is not localized. @stockiNail I'm using an object instead because I'm trying to run this line https://github.com/chartjs/chartjs-adapter-luxon/blob/master/src/index.js#L60 and get the localized string using Intl. If I set an invalid format like It seems that the custom format is merging with this default format. |
@kurkle The Luxon documentation says https://moment.github.io/luxon/#/formatting?id=intl-1
And this plugin is not setting the locale explicitly. |
I meant you should use
To set the locale information, you should use See #42 where it's explained which options you can set. See also this codepen, when a Config: scales: {
x: {
type: 'time',
...
adapters: {
date: {
locale: 'en'
}
},
...
}
} |
@ocarreterom Using your sandbox. Options Result |
@stockiNail that works! It's a little verbose to set the locale two times and I still think that the Intl notation should work. Thanks for your help! |
@ocarreterom Agree! See my open issue: chartjs/Chart.js#7859. Planned for CHART.JS version 4 |
@ocarreterom with version 1.2.0 of this adapter and Chart.js > 3.9.0, the adapter will use the In this way, you can set the locale only at chart options level. |
@stockiNail yes, this can be close. Thanks! |
Hi!
I'm trying to display the weekday but the result is unexpected.
I'm not sure if it's an error with this plugin, with Chartjs or I'm doing something wrong.
https://codesandbox.io/s/jovial-hermann-pnb72?file=/src/index.js
I expect to get the label
monday
,tuesday
but I getmonday, 29 nov
,tuesday, 30 nov
Thanks!
The text was updated successfully, but these errors were encountered: