summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Geier <geier@lostpackets.de>2023-10-27 14:41:32 +0200
committerChristian Geier <geier@lostpackets.de>2023-10-27 14:44:16 +0200
commit41b075eb51b65d8e35e619961cd6045404515c93 (patch)
tree001658b2411f57662f6bfa0001ed0322524ec4af
parent307b2c17acf579eb93b262166c9c9a4cb12f062c (diff)
ignore leading + in timedelta strings
-rw-r--r--khal/parse_datetime.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/khal/parse_datetime.py b/khal/parse_datetime.py
index c3915b20..c0605796 100644
--- a/khal/parse_datetime.py
+++ b/khal/parse_datetime.py
@@ -289,7 +289,7 @@ def guesstimedeltafstr(delta_string: str) -> dt.timedelta:
:param delta_string: string encoding time-delta, e.g. '1h 15m'
"""
- tups = re.split(r'(-?\d+)', delta_string)
+ tups = re.split(r'(-?\+?\d+)', delta_string)
if not re.match(r'^\s*$', tups[0]):
raise ValueError(f'Invalid beginning of timedelta string "{delta_string}": "{tups[0]}"')
tups = tups[1:]
@@ -297,6 +297,8 @@ def guesstimedeltafstr(delta_string: str) -> dt.timedelta:
for num, unit in zip(tups[0::2], tups[1::2]):
try:
+ if num[0] == '+':
+ num = num[1:]
numint = int(num)
except ValueError:
raise DateTimeParseError(