Skip to content

Commit

Permalink
fix: Fix parse_date for italy_anac
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed May 12, 2024
1 parent 4bf2a9c commit 3ceec42
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion data_registry/process_manager/task/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ def url_for_collection(*parts):

def parse_date(dt):
if dt:
# nigeria_ebonyi_state
# 2023-10-27T17:14:07:00Z nigeria_ebonyi_state
# ^^^
if dt.endswith("Z") and dt.count(":") == 3:
dt = ".".join(dt.rsplit(":", 1))

# 2024-05-01 16:30:04.160T12:00:00Z italy_anac
# ^^^^^^^^^
if " " in dt and "T12:00:00" in dt:
dt = dt.replace("T12:00:00", "").replace(" ", "T")

if len(dt) == 10:
return datetime.strptime(dt, "%Y-%m-%d").date()
elif "." in dt:
Expand Down

0 comments on commit 3ceec42

Please sign in to comment.