Method: PassiveSupport::CoreExtensions::Time::Calculations::ClassMethods#days_in_month

Defined in:
lib/passive_support/core_ext/time/calculations.rb

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

Return the number of days in the given month. If no year is specified, it will use the current year.



36
37
38
39
# File 'lib/passive_support/core_ext/time/calculations.rb', line 36

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