Rails have quite a few methods for use with the date and time just as strftime
, beginning_of_day
, mday
, etc.
Similarly, rails also provide some methods like beginning_of_quarter
and end_of_quarter
for getting dates of when the quarter for the calendar year and month is.
Rails do not provide methods for getting the monthly number for the quarter. For that, we would use something like -
Before
After
In the upcoming version of Rails 7.1, it’ll provide a method for getting quarter of the date it is used upon -
Look at PR for more information.