Module: TimeCrisis::Support::DaysInMonth

Defined in:
lib/time_crisis/support/days_in_month.rb

Constant Summary collapse

GregorianDaysInMonth =
[nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

Instance Method Summary collapse

Instance Method Details

#days_in_month(month, year = current.year) ⇒ Object



4
5
6
# File 'lib/time_crisis/support/days_in_month.rb', line 4

def days_in_month(month, year = current.year)
  (month == 2 && ::Date.gregorian_leap?(year)) ? 29 : GregorianDaysInMonth[month]
end