From 49c47edf184b95d86bd2203a3026c5bc0e409f02 Mon Sep 17 00:00:00 2001 From: giacomo accursi Date: Fri, 17 Feb 2023 16:27:35 +0100 Subject: [PATCH] chore: add date time formatter --- .../presenters/deserializer/SurgeryBookingJsonDeserializer.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/application/presenters/deserializer/SurgeryBookingJsonDeserializer.kt b/src/main/kotlin/application/presenters/deserializer/SurgeryBookingJsonDeserializer.kt index 3c84e588..1aa4c242 100644 --- a/src/main/kotlin/application/presenters/deserializer/SurgeryBookingJsonDeserializer.kt +++ b/src/main/kotlin/application/presenters/deserializer/SurgeryBookingJsonDeserializer.kt @@ -22,6 +22,7 @@ import entities.SurgeryDateTime import entities.SurgeryID import entities.SurgeryType import java.time.LocalDateTime +import java.time.format.DateTimeFormatter /** * A json deserializer implementation for [SurgeryBooking]. @@ -38,7 +39,8 @@ class SurgeryBookingJsonDeserializer : SurgeryBookingDeserializer { val surgeryType = SurgeryType(jsonObject.getSurgeryType()) val healthcareUserID = HealthcareUserID(jsonObject.getHealthcareUserID()) val healthProfessionalID = HealthProfessionalID(jsonObject.getHealthProfessionalID()) - val surgeryDateTime = SurgeryDateTime(LocalDateTime.parse(jsonObject.getSurgeryDateTime())) + val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME + val surgeryDateTime = SurgeryDateTime(LocalDateTime.parse(jsonObject.getSurgeryDateTime(), formatter)) return SurgeryBooking(surgeryID, surgeryType, healthcareUserID, healthProfessionalID, surgeryDateTime) }