class Sunspot::Type::TimeType

The time type represents times. Note that times are always converted to UTC before indexing, and facets of Time fields always return times in UTC.

Constants

XMLSCHEMA

Public Instance Methods

to_literal(value) click to toggle source
# File lib/sunspot/type.rb, line 213
def to_literal(value)
  to_indexed(value)
end

Private Instance Methods

value_to_utc_time(value) click to toggle source
# File lib/sunspot/type.rb, line 227
def value_to_utc_time(value)
  if value.respond_to?(:utc)
    value.utc
  elsif value.respond_to?(:new_offset)
    value.new_offset
  else
    begin
      Time.parse(value.to_s).utc
    rescue ArgumentError
      DateTime.parse(value.to_s).new_offset
    end
  end
end