Class: SpreadsheetBuilder::DateStringColumn

Inherits:
StringColumn show all
Defined in:
backend/app/model/spreadsheet_builder.rb

Instance Attribute Summary

Attributes inherited from StringColumn

#column, #index, #jsonmodel, #locked, #name, #property_name, #width

Instance Method Summary collapse

Methods inherited from StringColumn

#header_label, #path, #value_for

Constructor Details

#initialize(jsonmodel, name, opts = {}) ⇒ DateStringColumn

Returns a new instance of DateStringColumn.



82
83
84
# File 'backend/app/model/spreadsheet_builder.rb', line 82

def initialize(jsonmodel, name, opts = {})
  super(jsonmodel, name, opts)
end

Instance Method Details

#sanitise_incoming_value(value) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
# File 'backend/app/model/spreadsheet_builder.rb', line 86

def sanitise_incoming_value(value)
  return nil if value.nil?

  if value.is_a?(Date)
    value.iso8601
  elsif value.is_a?(Time)
    value.to_date.iso8601
  else
    value.to_s.strip
  end
end