vendor/plugins/less_monkey_patching/lib/date.rb
#duplication of rails' time calculation methods
duplication of rails' time calculation methods
duplication of rails ' time calculation methods
def months_since(months)
    year, month, mday = self.year, self.month, self.mday
    month += months
    while month < 1
      month += 12
      year -= 1
    end
    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
def months_since ( months ) year , month , mday = self . year , self . month , self . mday month += months while month < 1 month += 12 year -= 1 end 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
duplication of rails' time calculation methods
duplication of rails ' time calculation methods
# in case months is negative # in case months is positive
months
<not_specific>