Module: Mongoid::Extensions::Time::Conversions

Included in:
Time
Defined in:
lib/mongoid/extensions/time/conversions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#get(value) ⇒ Object



10
11
12
13
# File 'lib/mongoid/extensions/time/conversions.rb', line 10

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

#set(value) ⇒ Object



6
7
8
9
# File 'lib/mongoid/extensions/time/conversions.rb', line 6

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