Skip to content

Commit

Permalink
added chain offset logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Dawson committed Dec 18, 2023
1 parent a05e33d commit b6619b8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cylc/flow/cycling/iso8601.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,24 @@ def get_dump_format():
def get_point_relative(offset_string, base_point):
"""Create a point from offset_string applied to base_point."""
try:
interval = ISO8601Interval(str(interval_parse(offset_string)))
if len(re.split('\\+|-', offset_string)) > 2:
opperator = '+'
base_point_relative = base_point
for iso in re.split('(\\+|-)', offset_string):
if iso == '+' or iso == '-':
opperator = iso
elif iso != '':
if opperator == '-':
base_point_relative = base_point_relative.add(
ISO8601Interval(str(-1 * interval_parse(iso)))
)
elif opperator == '+':
base_point_relative = base_point_relative.add(
ISO8601Interval(str(interval_parse(iso)))
)
return base_point_relative
else:
interval = ISO8601Interval(str(interval_parse(offset_string)))
except IsodatetimeError:
return ISO8601Point(str(
WorkflowSpecifics.abbrev_util.parse_timepoint(
Expand Down

0 comments on commit b6619b8

Please sign in to comment.