Module: Humanoid::Extensions::DateTime::Conversions

Included in:
DateTime
Defined in:
lib/humanoid/extensions/datetime/conversions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#get(value) ⇒ Object



10
11
12
13
# File 'lib/humanoid/extensions/datetime/conversions.rb', line 10

def get(value)
  return nil if value.blank?
  ::Time.zone ? ::Time.parse(value.to_s).getlocal.to_datetime : value.to_datetime
end

#set(value) ⇒ Object



6
7
8
9
# File 'lib/humanoid/extensions/datetime/conversions.rb', line 6

def set(value)
  return nil if value.blank?
  ::DateTime.parse(value.to_s).utc
end