@@ -250,6 +250,17 @@ def interpolate_template(tmpl, params_dict):
250250 raise ParamExpandError ('bad template syntax' ) from None
251251
252252
253+ def _parse_iso_cycle_point (value : str ) -> str :
254+ """Helper for parsing initial/start cycle point option in
255+ datetime cycling mode."""
256+ if value == 'now' :
257+ return get_current_time_string ()
258+ try :
259+ return ingest_time (value , get_current_time_string ())
260+ except IsodatetimeError as exc :
261+ raise WorkflowConfigError (str (exc )) from None
262+
263+
253264class WorkflowConfig :
254265 """Class for workflow configuration items and derived quantities."""
255266
@@ -763,13 +774,7 @@ def process_initial_cycle_point(self) -> None:
763774 if orig_icp is None :
764775 raise WorkflowConfigError (
765776 "This workflow requires an initial cycle point." )
766- if orig_icp == "now" :
767- icp = get_current_time_string ()
768- else :
769- try :
770- icp = ingest_time (orig_icp , get_current_time_string ())
771- except IsodatetimeError as exc :
772- raise WorkflowConfigError (str (exc )) from None
777+ icp = _parse_iso_cycle_point (orig_icp )
773778 self .evaluated_icp = None
774779 if icp != orig_icp :
775780 # now/next()/previous() was used, need to store
@@ -810,8 +815,7 @@ def process_start_cycle_point(self) -> None:
810815 )
811816 if startcp :
812817 # Start from a point later than initial point.
813- if self .options .startcp == 'now' :
814- self .options .startcp = get_current_time_string ()
818+ self .options .startcp = _parse_iso_cycle_point (startcp )
815819 self .start_point = get_point (self .options .startcp ).standardise ()
816820 elif starttask :
817821 # Start from designated task(s).
0 commit comments