Sha256: ed2a52a6db010aba0acdfeebbe7e3379719120fabd7c86440f2706e95d06ea59

Contents?: true

Size: 439 Bytes

Versions: 56

Compression:

Stored size: 439 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module DateTime #:nodoc:
      module Conversions #:nodoc:
        def set(value)
          return nil if value.blank?
          ::DateTime.parse(value.to_s).utc
        end
        def get(value)
          return nil if value.blank?
          ::Time.zone ? ::Time.parse(value.to_s).getlocal.to_datetime : value.to_datetime
        end
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 lib/mongoid/extensions/datetime/conversions.rb
mongoid-2.0.0.alpha lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.14 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.13 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.12 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.11 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.10 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.9 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.8 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.7 lib/mongoid/extensions/datetime/conversions.rb
mongoid-pre-2.0.0.pre lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.6 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.5 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.4 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.3 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.2 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.1 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.2.0 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.1.4 lib/mongoid/extensions/datetime/conversions.rb
mongoid-1.1.3 lib/mongoid/extensions/datetime/conversions.rb