module ActiveModel::Type::Helpers::TimeValue

def serialize(value)

def serialize(value)
  value = apply_seconds_precision(value)
  if value.acts_like?(:time)
    if is_utc?
      value = value.getutc if !value.utc?
    else
      value = value.getlocal
    end
  end
  value
end