mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-15 03:25:48 +02:00
Add tests & fixes for date parsing
This commit is contained in:
parent
b85f5a612a
commit
ea6b204cf0
3 changed files with 181 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ def forward_to_next_weekday(day_dt: DateType, target_weekday: int, *, allow_toda
|
|||
raise ValueError
|
||||
|
||||
# Skip at least one day
|
||||
if not allow_today:
|
||||
if not allow_today and day_dt.weekday() == target_weekday:
|
||||
day_dt += datetime.timedelta(days=1)
|
||||
|
||||
while day_dt.weekday() != target_weekday:
|
||||
|
|
@ -76,7 +76,7 @@ def parse_dm_string(argument: str) -> datetime.date:
|
|||
return datetime.date(day=day, month=month, year=today.year)
|
||||
|
||||
# Month Day
|
||||
match = re.search(r"\d+", spl[0])
|
||||
match = re.search(r"\d+", spl[1])
|
||||
if match is not None:
|
||||
day = int(match.group())
|
||||
month = str_to_month(spl[0])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue