Last date of the previous month – Bash – Debian
I want to get the Last date of the previous month and the code I'm using is date -d "$(2022-04-30 +%Y%m01) -1 month" +%Y-%m-%d. The output I'm getting is 2022-04-24 instead of 2022-03-31. I'm using Debian Linux.