> immediately before the start of the corresponding day
A month ends at the end of a day, regardless of the length of that day or any other day during the month.
A month ends at the end of a day, regardless of the length of that day or any other day during the month.
The OP's request was to make it simpler.
With time, you often can't do that without edge cases.