Class: Terrazzo::Field::Date
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#attribute, #data, #options, #page, #resource
Instance Method Summary collapse
Methods inherited from Base
associative?, default_options, eager_load?, #field_type, field_type, #form_input_attributes, #initialize, permitted_attribute, #required?, searchable?, #serializable_options, sortable?, transform_param, with_options
Constructor Details
This class inherits a constructor from Terrazzo::Field::Base
Instance Method Details
#serialize_value(_mode) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/terrazzo/field/date.rb', line 4 def serialize_value(_mode) return nil if data.nil? value = if [:timezone] data.in_time_zone([:timezone]).to_date elsif data.respond_to?(:in_time_zone) data.in_time_zone.to_date else data end format = [:format] format ? value.strftime(format) : value.to_s end |