ruby on rails - Lazy Highcharts DateTime formatting -


i'm using lazy highcharts implement json data , when import data reads date fine, not time. have date time '2014-08-11t11:30:00+00:00' high charts reads '2014-08-11t00:00:00+00:00'. i've tried strftime("%d/%m/%y %h:%m") match format, gives me error: undefined methodyear' "11/08/2014 11:30":string`

controller

dates = [] temps = [] dt = []  @data['data'].flatten.each |data|   dates << data.keys   temps << data.values end  dates.flatten.each |date|   dt << datetime.parse(date) end  @start = dt.first  @graph = lazyhighcharts::highchart.new('graph') |f|   f.series(:type => 'line', :name => 'temperature', data: temps, pointstart: @start, :pointinterval => 30.minutes )   f.xaxis [ type: "datetime" ] end 

enter image description here

can put calling strftime? think if do

dt << datetime.parse(date).strftime("%d/%m/%y %h:%m")

everything should work fine, because error looks you're trying call strftime on string


Comments

  1. It is nice blog Thank you provide important information and i am searching for same information to save my time Ruby on Rails Online Training

    ReplyDelete

Post a Comment