When your client wants to cancel the hosting plan but only at the end of the contract, the only way is to remember the date of cancellation of the hosting one day before the end of the hosting period.
I propose that by cancelling the hosting plan, the cancellation ends at the end of the period and not immediately. Why not add a possibility to schedule the end date of the contract.
This solution would be possible with a hosting plan per month or per year.