Sha256: 4e92335081d4ea6562772e47178c71c68ee6c1f751457b1a134d05f300fff447

Contents?: true

Size: 348 Bytes

Versions: 1

Compression:

Stored size: 348 Bytes

Contents

module PureForm
  module Types
    class DateTimeType < BaseType
      def typecast(value)
        value.to_datetime
      rescue TypeError, ArgumentError, NoMethodError
        nil
      end

      def complex_typecast(*args)
        DateTime.new(*args)
      rescue TypeError, ArgumentError, NoMethodError
        nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pure_form-0.0.2 lib/pure_form/types/date_time.rb