I am stuck at a point I am trying to check if the date is in between two dates, Dates are coming from objects of python with for loop.
Date_from is starting date e.g 01-04-2021
date_to is end date e.g 05-04-2021
check_in is the date I want to check e.g 03-04-2021
Python code:
if check_in.date() in ((d.date_from.date() for d in holidays) < ((d.date_to.date() for d in holidays))):
print("date is in between")
else:
print("Not in between")
I have also tried this code but not successful.
if check_in.date() in ((d.date_from.date() for d in holidays) or ((d.date_to.date() for d in holidays))):
print("date is in between")
else:
print("Not in between")
Here referring to this URL source to check date lies in between two dates I am getting this error.
TypeError: '<' not supported between instances of 'generator' and 'generator'
Can anyone guide me on how can I check it?