doubledate.next#

doubledate.next(weekday: str, *, asof=None) date#

Returns the first weekday strictly after the asof date (or today) for which the weekday is equal to the passed weekday argument.

Weekday must be one of 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT' or 'SUN'.

Parameters:
  • weekday (str) – the target weekday

  • asof (datetime.date, optional) – the date from which to determine the next date (default is today)

Returns:

The first weekday strictly after the asof date

Return type:

datetime.date

Examples

>>> next("MON") #assume today is Wed 15 Jan 2020
datetime.date(2020, 1, 20)
>>> next("WED")
datetime.date(2020,1,22)
>>> next("MON", asof=datetime.date(2020,1,15))
datetime.date(2020, 1, 20)

See also

sow

compute start of week

last

compute last weekday (e.g. Monday)