My application takes two dates from a user via jQuery Datepicker with a specified time. How can I pass this into my HighCharts javascript as the pointStart attribute?
I store the start date in the controller as:
@start = :time.chop+":00"
The resulting format is:
"2011-12-06 12:00:00"
In my highcharts series section I use the following which displays the data correctly but uses the default date of Jan 1, 1970. The commented line also fails:
series: [{
pointInterval: <%= 30.minute %>,
pointStart: <%= @start %>,
//pointStart: <%= @start.to_date %>,
data: <%= @data %>
}]
Am I using the correct date format, or is the only option to convert the date to milliseconds? I know it is something small I’m missing but cannot figure it out.
Yes, highcharts (well really JavaScript) needs you to convert to milliseconds. So if @start is a Time object: