Module: Mongoid::Extensions::TimeConversions
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#get(value) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/mongoid/extensions/time_conversions.rb', line 10 def get(value) return nil if value.blank? value = value.getlocal unless Mongoid::Config.use_utc? if Mongoid::Config.use_activesupport_time_zone? time_zone = Mongoid::Config.use_utc? ? 'UTC' : Time.zone value = value.in_time_zone(time_zone) end value end |
#set(value) ⇒ Object
4 5 6 7 8 |
# File 'lib/mongoid/extensions/time_conversions.rb', line 4 def set(value) return nil if value.blank? time = convert_to_time(value) strip_milliseconds(time).utc end |