Skip to content

Commit

Permalink
same for relativedelta
Browse files Browse the repository at this point in the history
  • Loading branch information
NoobInDaHause committed Mar 6, 2024
1 parent c38e7ee commit 31e138d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions redbot/core/commands/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ def parse_relativedelta(
]
params = _parse_and_match(argument, allowed_units)
if params:
if params.get("years"): # convert years to days
years = params.pop("years")
params.setdefault("days", 0)
params["days"] += 30 * years
if params.get("months"): # convert months to days
months = params.pop("months")
params.setdefault("days", 0)
params["days"] += 365 * months
try:
delta = relativedelta(**params)
except OverflowError:
Expand Down

0 comments on commit 31e138d

Please sign in to comment.