Class: ReeDate::EndOfQuarter

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

Instance Method Summary collapse

Instance Method Details

#call(date = nil) ⇒ Object



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

def call(date = nil)
  date = date || today
  last_quarter_month = date.month + (12 - date.month) % 3
  last_day = days_in_month(last_quarter_month, date.year)
  change(date, day: last_day, month: last_quarter_month)
end