How do you format the date in a datapoint's label in Chart.JS?
I've tried this:
this.chart = new Chart(ctx,
{
data: {
labels: timestamps
.map(t => t.toLocaleString([], { month: '2-digit', day: '2-digit', year: '2-digit', hour: '2-digit', minute: '2-digit' })),
datasets: [
{
data: measurements
},
//etc...
]}});
It works, but I get a Moment.JS warning message:
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format... Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release.
Is there a proper way to format dates for data labels in Chart.JS since the method I am using is apparently discouraged?
With labels: timestamps
With labels: timestamps.map(t => t.toLocaleString(...)