class IntercomRails::DateHelper

Public Class Methods

convert_dates_to_unix_timestamps(object) click to toggle source
# File lib/intercom-rails/date_helper.rb, line 3
def self.convert_dates_to_unix_timestamps(object)
  return Hash[object.map { |k, v| [k, convert_dates_to_unix_timestamps(v)] }] if object.is_a?(Hash)
  return object.to_i if object.is_a?(Time) || object.is_a?(DateTime)
  return object.to_time.to_i if object.is_a?(Date)
  object
end