Class: ReeDate::DaysInMonth

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_date/package/ree_date/functions/days_in_month.rb

Instance Method Summary collapse

Instance Method Details

#call(month, year = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/ree_lib/packages/ree_date/package/ree_date/functions/days_in_month.rb', line 16

def call(month, year = nil)
  year = year || today.year

  if month == 2 && Date.gregorian_leap?(year)
    29
  else
    COMMON_YEAR_DAYS_IN_MONTH[month - 1]
  end
end