Class: PureForm::Types::DateType

Inherits:
BaseType
  • Object
show all
Defined in:
lib/pure_form/types/date.rb

Instance Method Summary collapse

Methods inherited from BaseType

#initialize

Constructor Details

This class inherits a constructor from PureForm::Types::BaseType

Instance Method Details

#complex_typecast(year, month, day) ⇒ Object



10
11
12
13
14
# File 'lib/pure_form/types/date.rb', line 10

def complex_typecast(year, month, day)
  Date.new(year, month, day)
rescue TypeError, ArgumentError
  nil
end

#typecast(value) ⇒ Object



4
5
6
7
8
# File 'lib/pure_form/types/date.rb', line 4

def typecast(value)
  value.to_date
rescue TypeError, ArgumentError, NoMethodError
  nil
end