Chartjs-ChartJs x-axis label to be in dateTime format issue: DD-MMM-YYYY, but displayed as MMM-YYYY-DD

0👍

Assuming your x-axis is already defined as a time cartesian axis, you can define the option time.displayFormats.day in order to see the date in the desired format.

This could look as follows:

xAxes: [{
  type: 'time',
  time: {
    unit: 'day',
    displayFormats: {
      day: 'DD-MMM-YYYY'
    },
    tooltipFormat: 'DD-MMM-YYYY'
  }
}]

Leave a comment