Class: IntercomRails::DateHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/intercom-rails/date_helper.rb

Class Method Summary collapse

Class Method Details

.convert_dates_to_unix_timestamps(object) ⇒ Object


3
4
5
6
7
# 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)
  object
end