All day, week, month, quarter, year... in Rails

Rails has some fancy helpers on date and time objects:

date = Time.zone.today

date.all_day
# => Wed, 12 May 2021 00:00:00.000000000 UTC +00:00..Wed, 12 May 2021 23:59:59.999999999 UTC +00:00

date.all_week
# => Mon, 10 May 2021..Sun, 16 May 2021

date.all_month
# => Sat, 01 May 2021..Mon, 31 May 2021

all_quarter
# => Thu, 01 Apr 2021..Wed, 30 Jun 2021

date.all_year
# => Fri, 01 Jan 2021..Fri, 31 Dec 2021

https://api.rubyonrails.org/v6.1.3/classes/DateAndTime/Calculations.html