Release 0.3

Signed-off-by: Marc Ahlgrim <marc@onemarcfifty.com>
This commit is contained in:
Marc Ahlgrim
2022-07-22 12:50:06 +02:00
parent e58ba3a745
commit 6e35d9e064
15 changed files with 497 additions and 173 deletions
-10
View File
@@ -3,22 +3,12 @@ import datetime
# ################################################
# Returns the date of the next given weekday after
# the given date. For example, the date of next Monday.
#
# NB: if it IS the day we're looking for, this returns 0.
# consider then doing onDay(foo, day + 1).
#
# Monday=0, Tuesday=1 .... Sunday=6
# ################################################
def onDay(date, day):
"""
Returns the date of the next given weekday after
the given date. For example, the date of next Monday.
NB: if it IS the day we're looking for, this returns 0.
consider then doing onDay(foo, day + 1).
"""
days = (day - date.weekday() + 7) % 7
return date + datetime.timedelta(days=days)