Sha256: fe41429bb241116e283792041c310ab7e7d4254804e7351490cb26c95ca13c54

Contents?: true

Size: 376 Bytes

Versions: 7

Compression:

Stored size: 376 Bytes

Contents

module DataMapper
  class Property

    class ParseDate < Object

      def dump(value)
        value && {"__type" => "Date", "iso" => value.utc.iso8601(3)}
      end

      def load(value)
        value && (value.is_a?(Hash) ? value["iso"].to_datetime : value.to_datetime)
      end

      def typecast(value)
        value && value.to_datetime
      end

    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dm-parse-0.3.9 lib/property/parse_date.rb
dm-parse-0.3.8 lib/property/parse_date.rb
dm-parse-0.3.7 lib/property/parse_date.rb
dm-parse-0.3.6 lib/property/parse_date.rb
dm-parse-0.3.5 lib/property/parse_date.rb
dm-parse-0.3.4 lib/property/parse_date.rb
dm-parse-0.3.3 lib/property/parse_date.rb