you can do this better with power automate, then with calculated fields. Those are only a calculated view and consist of not real data. To consistantly manipulate your SharePoint Fields, just set 2 normal additional text fields within your list or library. These text fields you can calculate in an automatic flow, e.g. when an item is created or modified.
The dates-data then will be transformed into text, with the json code, back to your list.
Specially when your second calculated field has to have a condition, I recommend strongly to do that in power automate.
If you don´t where to start to learn it with date calculations, pls. explore the youtube videos from Audrie Gordon and her Friday's Functions Series. I learned a lot from her and can remember one of her videos dealing with date functions... Hope that helps, Eva.