Class: PureForm::Types::DateTimeType

Inherits:
BaseType
  • Object
show all
Defined in:
lib/pure_form/types/date_time.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(*args) ⇒ Object



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

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

#typecast(value) ⇒ Object



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

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