alexokros
Posts: 3
Joined: Wed Dec 01, 2021 6:26 pm

xDateFormat on Tooltip not working

I have tried using the xDateFormat option to format the date on the header of my tooltip. It seems like the x date formatter doesn't work with Dates in particular.

Below is a JSFiddle of the replicated problem.
https://jsfiddle.net/alexokros/eu7z5rLm/
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: xDateFormat on Tooltip not working

Hello alexokros,

Welcome to our forum and thanks for contacting us with your question!

Highcharts expects dates to be in a UTC timestamp format expressed in milliseconds. Use getTime method on your dates and everything should work correctly.
Demo: https://jsfiddle.net/BlackLabel/n3241w0v/
API reference: https://api.highcharts.com/class-refere ... dateFormat

Let me know if that was what you were looking for!
Regards!
Mateusz Bernacik
Highcharts Developer
alexokros
Posts: 3
Joined: Wed Dec 01, 2021 6:26 pm

Re: xDateFormat on Tooltip not working

That seemed to fix the problem, thanks!
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: xDateFormat on Tooltip not working

You're welcome! In case of any further questions, feel free to contact us again.
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”