Skip to content

Commit

Permalink
chore: add date time formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomoaccursi committed Feb 28, 2023
1 parent 8a2880b commit 49c47ed
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -38,7 +39,8 @@ class SurgeryBookingJsonDeserializer : SurgeryBookingDeserializer<String> {
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)
}

Expand Down

0 comments on commit 49c47ed

Please sign in to comment.