#http://brandonhilkert.com/blog/relative-timestamps-in-rails/
module TimeHelper
  def timeago(time, options = {})
    options[:class] = "#{options[:class]} timeago"
    content_tag(
        :time,
        time.to_s,
        options.merge(datetime: time.getutc.iso8601)
    ) if time
  end

  def duration(duration, options = {})
    options[:class] = "#{options[:class]} duration"
    content_tag(
        :time,
        duration.to_s,
        options.merge(duration: duration.to_s)
    ) if duration
  end
end