Skip to content

Commit

Permalink
fixed bug -> ' TO ' as split value shouldn't depend on spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Foerster authored and Christian Foerster committed Jul 4, 2023
1 parent b53ec5b commit 9b2d9f5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ckanext/eaw_core/validators/date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ def vali_daterange(values):
+ insert trailing "Z" for points in time if necessary
+ add brackets if necessary
"""

values = load_datetime_strings(values)
valid_values = []
for value in values:
value = value.strip()
# datetime range
if "TO" in value:
start, end = value.strip("[]").split(" TO ")
value = f"[{add_zulu_to_timestamp(start)} TO {add_zulu_to_timestamp(end)}]"
start, end = value.strip("[]").split("TO")
value = f"[{add_zulu_to_timestamp(start.strip())} TO {add_zulu_to_timestamp(end.strip())}]"
else:
value = add_zulu_to_timestamp(value)

Expand Down

0 comments on commit 9b2d9f5

Please sign in to comment.