mirror of
https://github.com/evennia/evennia.git
synced 2026-03-29 03:57:17 +02:00
Fix issue in validatorfuncs.timedelta() in which days and years (in days) aren't added to create datetime.timedelta(days=days, ...).
This commit is contained in:
parent
8ee9eb5eef
commit
fffa1937e5
1 changed files with 6 additions and 6 deletions
|
|
@ -102,17 +102,17 @@ def duration(entry, option_key="Duration", **kwargs):
|
|||
|
||||
for interval in time_string:
|
||||
if _re.match(r"^[\d]+s$", interval):
|
||||
seconds = +int(interval.rstrip("s"))
|
||||
seconds += int(interval.rstrip("s"))
|
||||
elif _re.match(r"^[\d]+m$", interval):
|
||||
minutes = +int(interval.rstrip("m"))
|
||||
minutes += int(interval.rstrip("m"))
|
||||
elif _re.match(r"^[\d]+h$", interval):
|
||||
hours = +int(interval.rstrip("h"))
|
||||
hours += int(interval.rstrip("h"))
|
||||
elif _re.match(r"^[\d]+d$", interval):
|
||||
days = +int(interval.rstrip("d"))
|
||||
days += int(interval.rstrip("d"))
|
||||
elif _re.match(r"^[\d]+w$", interval):
|
||||
weeks = +int(interval.rstrip("w"))
|
||||
weeks += int(interval.rstrip("w"))
|
||||
elif _re.match(r"^[\d]+y$", interval):
|
||||
days = +int(interval.rstrip("y")) * 365
|
||||
days += int(interval.rstrip("y")) * 365
|
||||
else:
|
||||
raise ValueError(f"Could not convert section '{interval}' to a {option_key}.")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue