I\'m trying to add n (integer) working days to a given date, the date addition has to avoid the holidays and weekends (it\'s not included in the working days)
There is no real shortcut to do this. Try this approach:
skip(self, d) which returns True for dates that should be skipped.datetime or similar because the fractions of a day will kill you.True for any date that is in the dictionary or d.weekday() >= 5To add N days, use this method:
def advance(d, days):
delta = datetime.timedelta(1)
for x in range(days):
d = d + delta
while holidayHelper.skip(d):
d = d + delta
return d