Class: Fields::Date
- Inherits:
-
Field
- Object
- Field
- Fields::Date
- Defined in:
- app/models/iron/fields/date.rb
Constant Summary collapse
- TIME_DESIGNATOR =
/[Tt ]/
Instance Method Summary collapse
Instance Method Details
#content_value=(value) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'app/models/iron/fields/date.rb', line 5 def content_value=(value) @content_errors = nil if value.blank? self.value_datetime = nil else self.value_datetime = parse_iso8601(value.to_s) end rescue ArgumentError add_content_error("must be a valid ISO8601 date or datetime") end |
#export_value ⇒ Object
22 23 24 |
# File 'app/models/iron/fields/date.rb', line 22 def export_value { type: "date", value: value_datetime&.iso8601 } end |
#filled? ⇒ Boolean
16 |
# File 'app/models/iron/fields/date.rb', line 16 def filled? = !value_datetime.nil? |
#value ⇒ Object
18 19 20 |
# File 'app/models/iron/fields/date.rb', line 18 def value value_datetime end |