Module: Redmine::CoreExtensions::Date::Calculations

Included in:
Date
Defined in:
lib/redmine/core_ext/date/calculations.rb

Overview

Custom date calculations

Instance Method Summary collapse

Instance Method Details

#months_ago(date = self.class.today) ⇒ Object

Deprecated.

Removed at 4.0.0

Returns difference with specified date in months

Since:

  • 1.4.0



24
25
26
# File 'lib/redmine/core_ext/date/calculations.rb', line 24

def months_ago(date = self.class.today)
  (date.year - self.year)*12 + (date.month - self.month)
end

#weeks_ago(date = self.class.today) ⇒ Object

Deprecated.

Removed at 4.0.0

Returns difference with specified date in weeks

Since:

  • 1.4.0



29
30
31
# File 'lib/redmine/core_ext/date/calculations.rb', line 29

def weeks_ago(date = self.class.today)
  (date.year - self.year)*52 + (date.cweek - self.cweek)
end