I am trying to set an expiry date for the user's cancellation in my booking system project and I have tried this code but it is not working and it is not logically correct. Can anyone help me in getting the idea to implement this feature for my project?
Date expiryDate = new Date().after(startDate) -7
if(startDate.before(expiryDate))
The idea is that the user should not be able to cancel the reservation if the expiryDate is close to one week before the startDate of the flight. In real-world we see that we can not cancel an order if it is shipped and passes 24 hours after we placed it.