Method: DateAndTime::Calculations#end_of_month

Defined in:
activesupport/lib/active_support/core_ext/date_and_time/calculations.rb

#end_of_monthObject Also known as: at_end_of_month

Returns a new date/time representing the end of the month. DateTime objects will have a time set to 23:59:59.



296
297
298
299
# File 'activesupport/lib/active_support/core_ext/date_and_time/calculations.rb', line 296

def end_of_month
  last_day = ::Time.days_in_month(month, year)
  last_hour(days_since(last_day - day))
end