thingspeak/config/initializers/timestamp_json_override.rb
2014-02-17 12:05:39 -05:00

12 lines
359 B
Ruby

#Changing the as_json method to remove the milliseconds from TimeWithZone to_json result (just like in Rails 3)
class ActiveSupport::TimeWithZone
def as_json(options = {})
if ActiveSupport::JSON::Encoding.use_standard_json_time_format
xmlschema
else
%(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
end
end
end