class Forme::Serializer::AmericanTime

  1. lib/forme/transformers/serializer.rb
Superclass: Serializer

Overrides formatting of dates and times to use an American format without timezones.

Methods

Public Instance

  1. call

Public Instance methods

call (tag)
[show source]
# File lib/forme/transformers/serializer.rb, line 100
def call(tag)
  case tag
  when Tag
    if tag.type.to_s == 'input' && %w'date datetime datetime-local'.include?((tag.attr[:type] || tag.attr['type']).to_s)
      attr = tag.attr.dup
      attr.delete(:type)
      attr.delete('type')
      attr['type'] = 'text'
      "<#{tag.type}#{attr_html(attr)}/>"
    else
      super
    end
  else
    super
  end
end