Reputation: 139
I am using high charts (spline chart) to show avg of data versus date. Date values before rendering to chart on server side is array :
dates = [2015-11-07, 2015-11-08,2015-11-09,2015-11-07,2015-11-11,2015-11-13, 2015-11-14];
on client side the date array is getting changed to below values: dates =[1997, 1998, 1999, 2000, 2001, 2002]
I am node js on server side. The problem I know is with the date format from server side. The date values on server side I am getting from database. So to what format I should change my date before sending it to client and how?
Upvotes: 0
Views: 36
Reputation: 4769
you need to set dates as timestamps or UTC date. You need to write a function to make them as Javascript date object. then use date.getTime() which will return you timestamps relvant to your date.
At XAxis labels, you should also define dateTimeFormat in which you want to see dates on xAxis, Means dd/mm/yy or mm/yy/dd etc.
Upvotes: 1