Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/rfeedparser/monkey_patches.rb

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.days_in_month(month, year = now.year) ⇒ Object



5
6
7
8
# File 'lib/rfeedparser/monkey_patches.rb', line 5

def days_in_month(month, year = now.year)
  return 29 if month == 2 && ::Date.gregorian_leap?(year)
  COMMON_YEAR_DAYS_IN_MONTH[month]
end