Calculate next renewal date

Have you seen this?

I think it could be adapted to achieve what you need