I am working on a dashboard application using Rails 3.1.1 / Highcharts with multiple charts, but I am stuck on converting a date string from a rails model to a javascript format that highcharts can accept.
My sample code is:
<%= @orders.map{ |f| [f.date, f.units.to_f] }.inspect %>
Produces this conclusion:
[[Fri, 04 Nov 2011, 182.0], [Sun, 06 Nov 2011, 189.0], [Tue, 08 Nov 2011, 178.0], [Thu, 10 Nov 2011, 115.0], [Sat, 12 Nov 2011, 135.0], [Mon, 14 Nov 2011, 120.0], [Thu, 17 Nov 2011, 181.0], [Sun, 20 Nov 2011, 145.0]]
I need to have an array date format as follows:
Date.UTC(2010, 10, 4).
Any suggestions on the existing rail / ruby โโmethod or how to create an assistant?
source share