Module: Mongoid::Criteria::Queryable::Extensions::Date

Defined in:
build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/date.rb

Overview

This module contains additional date behavior.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__evolve_date__Time

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

Examples:

Evolve the date.

date.__evolve_date__

Returns:

  • (Time)

    The date as a UTC time at midnight.



17
18
19
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/date.rb', line 17

def __evolve_date__
  ::Time.utc(year, month, day, 0, 0, 0, 0)
end

#__evolve_time__Time

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

Examples:

Evolve the date.

date.__evolve_time__

Returns:

  • (Time)

    The date as a local time.



27
28
29
# File 'build/mongoid-8.1/lib/mongoid/criteria/queryable/extensions/date.rb', line 27

def __evolve_time__
  ::Time.local(year, month, day)
end