Get Free Trial

Get correct datetime value on Highcharts

Answered
Denis asked on January 11, 2021

Hello,
 
I have an issue with getting correct datetime value from the pivot table.
 
I passed column with datetime type to pivot and it displayed as expected. But when I try to display the same data on a Highcharts  I get NaN or date (but with wrong time zone)
 
Please see an example https://jsfiddle.net/hxuc4ver/
 
Best regards,
Denis

7 answers

Public
Milena Pechura Milena Pechura Flexmonster January 13, 2021

Hi, Denis,
 
Thank you for posting to our forum.
 
Our team is currently working on your case.
We will reach out to you as soon as possible.
 
Kind regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster January 15, 2021

Hi, Denis,
 
Thank you for giving us some time to investigate your case.
 
Testing your example, we discovered that defining report.options.dateTimePattern fixes the issue with NaN values. Speaking of timezones, we would like to kindly inform you that using JS functions, the timestamp can be converted to the date with any desired timezone.
For example, to remain your ‘datetime’ values the same as in the dataset, you can convert the timestamp to the Date Object and then use the toLocaleString function.
 
Our team modified your example to illustrate the mentioned approaches: https://jsfiddle.net/flexmonster/8d25qxcs/.
We added dateTimePattern to the report and the timestamp conversion in the callbackHandler and updateHandler of highcharts.getData function.
 
Please let us know if it helps.
Waiting for your reply.
 
Kind regards,
Milena

Public
Denis January 15, 2021

Hello Milena,
 
Thanks for your help.
 
I see that your solution to fix NaN doesn’t work with dateTimePattern like ‘dd/MM/yyyy HH:mm:ss’
 
Could it be fixed?
 
Thanks once again.
 
Best regards,
Denis

Public
Denis January 15, 2021

Hello Milena,
 
Further to previous message. I’ve checked all available date formats that used In my application. Here is a list of problematic formats:

  • yyyyMMdd
  • dd/MM/yyyy
  • dd/MM/yy
  • dd.MM.yyyy
  • dd.MM.yy
  • dd-MM-yyyy
  • dd-MM-yy
  • MMddyyyy
  • MMddyy (it works)

 
Best regards,
Denis 

Public
Milena Pechura Milena Pechura Flexmonster January 18, 2021

Hi, Denis,
 
Thank you for reporting the issue with dateTimePattern and some date formats.
 
Our team is going to provide the update with the fixes ETA 8 Feb.
We will notify you as soon as the new version is released.
 
Please let us know if any additional questions arise.
 
Kind regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster February 9, 2021

Hello, Denis,
 
We are happy to let you know that the issue with getData() output when working with dates was fixed.
This is available in the 2.8.26 version of Flexmonster: https://www.flexmonster.com/release-notes/.
 
You are welcome to update the component.
Here is our updating to the latest version guide for assistance: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
 
Please let us know if everything works.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster February 22, 2021

Hi, Denis,
 
Our team is wondering whether the recent fix helped.
Please let us know if everything works fine.
 
We are looking forward to hearing from you.
 
Kind regards,
Milena

Please login or Register to Submit Answer