# File lib/active_support/core_ext/time/calculations.rb, line 66 def months_since(months) year, month, mday = self.year, self.month, self.mday month += months # in case months is negative while month < 1 month += 12 year -= 1 end # in case months is positive while month > 12 month -= 12 year += 1 end max = ::Time.days_in_month(month, year) mday = max if mday > max change(:year => year, :month => month, :mday => mday) end