Module: PassiveSupport::CoreExtensions::Date::Calculations::ClassMethods

Defined in:
lib/passive_support/core_ext/date/calculations.rb

Instance Method Summary collapse

Instance Method Details

#currentObject

Returns Time.zone.today when config.time_zone is set, otherwise just returns Date.today.



30
31
32
# File 'lib/passive_support/core_ext/date/calculations.rb', line 30

def current
  ::Time.zone_default ? ::Time.zone.today : ::Date.today
end

#tomorrowObject

Returns a new Date representing the date 1 day after today (i.e. tomorrow’s date).



25
26
27
# File 'lib/passive_support/core_ext/date/calculations.rb', line 25

def tomorrow
  ::Date.today.tomorrow
end

#yesterdayObject

Returns a new Date representing the date 1 day ago (i.e. yesterday’s date).



20
21
22
# File 'lib/passive_support/core_ext/date/calculations.rb', line 20

def yesterday
  ::Date.today.yesterday
end