Hey guys,
I have a field named “days_to_sign_off” which will calculate the days between today and a date entered in another field named “contract_expiry_date”. What I need is when I am looking the page today and the difference between the dates (date.today() and contract expiry date) is 10 , then when I look tomorrow, the difference should be 9 automatically.
This is my code to find the difference between dates and it is working:
def validate(self):
if lists.contract_expiry is not None:
today = datetime.strptime(str(date.today()), “%Y-%m-%d”).date()
con_exp__date = datetime.strptime(str(lists.contract_expiry), “%Y-%m-%d”).date()
delta = str(con_exp__date - today)
differenz = delta[:(len(delta)) - 9]
Please do help me with a solution.