Class: Typero::DatetimeType
- Defined in:
- lib/typero/type/types/datetime_type.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Type
Type::ERRORS, Type::OPTS, Type::OPTS_KEYS
Instance Attribute Summary
Attributes inherited from Type
Instance Method Summary collapse
Methods inherited from Type
allowed_opt?, #db_field, db_schema, #default, error, #get, #initialize, load, opts, #value
Constructor Details
This class inherits a constructor from Typero::Type
Instance Method Details
#db_schema ⇒ Object
21 22 23 |
# File 'lib/typero/type/types/datetime_type.rb', line 21 def db_schema [:timestamp] end |
#set ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/typero/type/types/datetime_type.rb', line 9 def set unless [Time, DateTime].include?(value.class) begin value { |data| DateTime.parse(data.to_s) } rescue Date::Error, ArgumentError error_for(:invalid_datetime) end end check_date_min_max end |