Just another note that since Elixir 1.17, you can shift a date using Date.shift/2.
So, to get the beginning and end of the previous month, you could do:
beginning_of_previous_month =
Date.utc_today()
|> Date.beginning_of_month()
|> Date.shift(months: -1)
end_of_previous_month = Date.end_of_month(beginning_of_previous_month)






















