module Mongoid::Criteria::Queryable::Extensions::Date

Adds query type-casting behavior to Date class.

Public Instance Methods

__evolve_date__() click to toggle source

Evolve the date into a mongo friendly time, UTC midnight.

@example Evolve the date.

date.__evolve_date__

@return [ Time ] The date as a UTC time at midnight.

# File lib/mongoid/criteria/queryable/extensions/date.rb, line 18
def __evolve_date__
  ::Time.utc(year, month, day, 0, 0, 0, 0)
end
__evolve_time__() click to toggle source

Evolve the date into a time, which is always in the local timezone.

@example Evolve the date.

date.__evolve_time__

@return [ Time | ActiveSupport::TimeWithZone ] The date as a local time.

# File lib/mongoid/criteria/queryable/extensions/date.rb, line 28
def __evolve_time__
  ::Time.zone.local(year, month, day)
end