Class: Time
Class Method Summary collapse
Class Method Details
.from_mongo(value) ⇒ Object
179 180 181 182 183 184 185 |
# File 'lib/mongo_mapper/support.rb', line 179 def self.from_mongo(value) if MongoMapper.use_time_zone? && value.present? value.in_time_zone(Time.zone) else value end end |
.to_mongo(value) ⇒ Object
170 171 172 173 174 175 176 177 |
# File 'lib/mongo_mapper/support.rb', line 170 def self.to_mongo(value) if value.nil? || value == '' nil else time = MongoMapper.time_class.parse(value.to_s) time && time.utc end end |