diff --git a/infrastructure/abri/abri_client.py b/infrastructure/abri/abri_client.py index 8ebd3ac2e..3c95c2766 100644 --- a/infrastructure/abri/abri_client.py +++ b/infrastructure/abri/abri_client.py @@ -1,4 +1,5 @@ import xml.etree.ElementTree as ET +from datetime import date from typing import List, Tuple, Union import requests @@ -21,6 +22,10 @@ CLIENT_CODE = "HSG" RESOURCE_GROUP = "Surveyors" +def _format_appointment_date(appointment_date: date) -> str: + return appointment_date.strftime("%d/%m/%Y") + + class AbriClient: def __init__(self, config: AbriConfig) -> None: self._config = config @@ -36,7 +41,7 @@ class AbriClient: ("short_description", request.short_description), ("long_description", request.long_description), ("client_ref", request.client_ref), - ("appointment_date", request.appointment_date.strftime("%d/%m/%Y")), + ("appointment_date", _format_appointment_date(request.appointment_date)), ("appointment_time", request.appointment_time), ("resource", self._config.default_resource), ("resource_group", RESOURCE_GROUP), @@ -52,7 +57,7 @@ class AbriClient: parameters = [ ("job_no", request.job_no), ("action", "amend"), - ("appointment_date", request.appointment_date.strftime("%d/%m/%Y")), + ("appointment_date", _format_appointment_date(request.appointment_date)), ("appointment_time", request.appointment_time), ] if request.resource is not None: