Closed kennethormandy closed 3 years ago
This already works, at least with @next
version: https://codepen.io/kurkle/pen/qBqOxwK
What versions are you using?
I wasn’t aware there was a @next
version, so I was using v1.0.0 from npm.
Since it looks like that’s already handled, I’ll close this. It might be worth adding a note about the latest version in the README. Thanks for the sample!
I think it’s possible to change
time.scale
with this adapter, but not possible to changetime.displayFormat
using this adapter.For example, you can change
time.unit
to'month'
to use date-fns to display the month, but you cannot usetime.displayFormats
to change the display ofmonth
from the default ofMMM yyyy
to your custom stringMMMM
.This Pull Request adds an option to pass in formats to modify the default FORMATS object.
If there’s a different way of doing that already, that’s fine too! I intentionally didn’t call it
displayFormats
as it seems confusing to havetime.displayFormats
and alsoadapters.data.displayFormats
, but maybe it’s also confusing to have them not match.This does use
Object.assign
for convenience, which I think works fine based on Chart.js’ browser support. If that’s an issue, the option could override the whole object instead.