Skip to content

Commit

Permalink
update date function to allow None return
Browse files Browse the repository at this point in the history
update date function to allow None return
  • Loading branch information
DJensen94 committed Feb 19, 2025
1 parent fe104b5 commit a542421
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/xfd_django/xfd_api/tasks/was_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ def fetch_dmz_was_finding_data(task_id):
return None


def convert_timestamp_to_date(timestamp: str) -> str:
def convert_timestamp_to_date(timestamp: str) -> str | None:
"""Convert an ISO 8601 timestamp to a date string in YYYY-MM-DD format."""
if timestamp:
try:
date_object = datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S")
formatted_date = date_object.strftime("%Y-%m-%d")
else:
except Exception:
formatted_date = None
return formatted_date

Expand Down

0 comments on commit a542421

Please sign in to comment.