An improvement for your date-finder.
A tool to handle timezones: pendulum
Previous I used pytz, but I got the tip from here that pendulum is easier to use.
I did not look for the GUI-Code, but with a function you can handle it more dynamic.
def get_next_date(visit_dates, visit_after, next_visit=10): # this could convert visit_dates and visit_after from # iso8601 timestamp (str) to date objects # visit_dates = [datetime.date.fromisoformat(d) for d in visit_dates] # visit_after = datetime.date.fromisoformat(visit_after) try: # Exception 1: Item not in visit_dates -> ValueError # The date was not in the list # Exception 2: Index > than length of list -> IndexError # In this case, it comes from + 1 # Date was found, but no date after return visit_dates[visit_dates.index(visit_after) + next_visit] # If no Exception happens, it will return the result except (ValueError, IndexError): # Catching this two Exceptions pass # raise an ValueError instead of returning None or something else # Catch the ValueError Exception on the caller side. raise ValueError(f'No visit date after {visit_after}')If you handle with workdays, repeating dates etc. you should look for dateutil
A tool to handle timezones: pendulum
Previous I used pytz, but I got the tip from here that pendulum is easier to use.
I did not look for the GUI-Code, but with a function you can handle it more dynamic.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!