Shouldn't you use all_month during the review by your seniors? I was told, so I was curious and examined it. Since it was defined in DateAndTime :: Calculations of ActiveSupport, read the surrounding methods as well.
I took a look at the internal implementation of all_month. It's an internal implementation of rails / rails, but you can see it in the readable code.
def all_month beginning_of_month..end_of_month end
Looking inside the same file, there were all_xxx methods other than all_month. There are many methods that can be used just by changing the target range.
There is a method to judge whether it is the future or the past! You can use what is rails / rails without redefining it! !! Noticed.
Date.yesterday.past? => true Date.yesterday.future? => false Date.tomorrow.future? => true Date.tomorrow.past? => false
next_xxx and prev_xxx are defined. prev_xxx is aliased to last_xxx.
Date.current => Sun, 11 Jul 2020 Date.current.next_week => Mon, 13 Jul 2020 Date.current.prev_week => Mon, 29 Jun 2020 Date.current.last_week => Mon, 29 Jun 2020