Class: ReeDate::BeginningOfQuarter

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_date/package/ree_date/functions/beginning_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/beginning_of_quarter.rb', line 19

def call(date = nil)
  date = date || today
  first_quarter_month = date.month - (2 + date.month) % 3

  change(date, day: 1, month: first_quarter_month)
end